DearVikki / obsidian-cloze-plugin

A plugin for Obsidian which enables converting highlights, underlines, bolded texts, or any selected texts into clozes.
Mozilla Public License 2.0
65 stars 4 forks source link

Cloze - Obsidian Plugin

English | 简体中文

Inspired from anki cards, this simple plugin for Obsidian enables you to create a cloze from special text segments (including highlighted, underlined, bolded texts and so on), as well as any selected text in reading mode.

Update: FYI, I just found that there is a fantastic plugin called Spaced Repetition that works just as an Obsidian version Anki, which also supports Cloze Cards. On the other hand, the Cloze plugin serves as more of a helper for reviewing pages/articles.

Use

Basic

Auto Convert

By enabling the following settings, the corresponding text will also automatically be converted into clozes in reading mode.

Custom Cloze

Select any text and right-click to open the Editor Menu.

Afterwards in the reading mode, you can toggle the visibility of a cloze area by just clicking it. If you want to toggle the visibility of all clozes, click on the ribbon icon --- the small fish.

Other Features

Cloze hint

Cloze hints are displayed as text within hidden cloze elements to serve as reminders.

There're mainly two options to give the cloze a hint by default.

🔥 New feature: You can also right-click on the cloze to access a menu option bar, and then click on "More Hint" to dynamically reveal a portion of the cloze.

Fixed cloze width

You may enable 'Fixed cloze width' in the settings, which helps to ensure that the original text length is not revealed.

Activation

The plugin is active on all notes by default, but you can configure it to only activate on notes with a specific tag. Simply provide the desired tag in the 'Required tag' setting.

Customized Editor Menu

You can customize editor menu by enabling/disabling the following settings.

Customized styles

There are certain css variables that you may customize via css snippets.

Variable Description
--cloze-underline-color Cloze underline color
--cloze-underline-width Cloze underline width
--cloze-underline-style Cloze underline style
--cloze-hint-color Cloze hint color
--cloze-hint-font-size Cloze hint font size
--cloze-fixed-width Cloze fixed width (if fix-width enabled)

Here is an example.

body {
    --cloze-underline-color: pink;
    --cloze-underline-width: 2px;
    --cloze-underline-style: dashed;
    --cloze-hint-color: blue;
    --cloze-hint-font-size: 30px;
    --cloze-fixed-width: 10px;
}

Best practices

Q&As

What's the visibility of the clozes when the page is exported to PDF?

Sadly, it can only be "all visibile" or "all hidden" for the present.

In reading mode, click the ribbon fish first, make sure that the page state is what you expect, and then click "export to PDF".

Installation

This plugin is available in the Obsidian community plugin store. Look for Cloze.

To manually install, simply download the required files and put them in your plugins folder.