中文说明
Quick Format
Quick Format 是一个用于 Anki 复习界面的右键快捷格式化插件。复习时选中卡片上的文字,点击右键,就可以直接改颜色、设置加粗,或创建 Cloze 挖空,不需要进入编辑窗口反复操作工具栏。
主要功能
- 在复习界面选中文字后,通过右键菜单直接格式化。
- 普通格式按钮可在
config.json 中配置,可修改按钮名称、颜色值和是否加粗,也可以自行增加按钮。
- 默认菜单顺序为:标红加粗、挖空、蓝色不加粗、绿色不加粗、紫色不加粗、粉色不加粗、黑色不加粗、黑色加粗、全卡格式清除。
- 全选卡面全部文字后点击“黑色不加粗”,可统一当前笔记所有字段的文字格式,并移除挖空和提示。
- 只有选中文字后才显示插件菜单;菜单最下方的“全卡格式清除”会清除当前笔记所有字段中的挖空、提示和常见文字格式,将文字统一为黑色、不加粗,同时保留图片、链接和布局。卡片空白处无选区右键保留 Anki 原生菜单。
- Anki 的多张卡片可能共用同一笔记;整卡操作更新所有字段,因此也会影响该笔记生成的其他卡面。
- “挖空”始终创建
{{c1::...}},不会根据已有挖空自动生成 c2、c3。
- 选区同时包含普通文字和一个或多个完整挖空时,也可以直接应用格式。使用其他颜色/加粗按钮会保留挖空语法和提示,并按“挖空颜色同步”设置决定挖空答案是否跟随按钮样式;关闭同步时,普通文字照常格式化,挖空答案保留原有颜色和粗细。
- 使用“黑色不加粗”时,选区内完整挖空会连同提示一起移除,选中的普通文字和挖空答案内容都会变成黑色、不加粗的纯文本。
- 只选择部分挖空答案会安全拒绝。单独选中一个完整挖空时,普通颜色/加粗按钮仍沿用原有格式转换行为。
- “工具 -> Quick Format”菜单依次提供“挖空颜色同步”“使用说明”和“关于”。颜色同步默认开启;关闭后,混合选区中的挖空答案保留原有颜色和粗细,普通文字仍按按钮格式化。
- 支持包含 HTML 标签、HTML 实体、换行、连续空格和重复文字的字段内容;普通格式化选区中的换行会保留为 HTML
<br>。
- 普通颜色格式支持含空格并跨越安全段落边界的选区,同时保留原有段落布局。
- 已经通过 Quick Format 设置过格式的文字,可以连同前后普通文字一起重新选择,再转换成其他颜色或挖空。
- 默认开启 Anki 撤销保护;整卡操作仅在字段内容确有变化时创建撤销检查点。
使用方法
- 在 Anki 复习界面选中卡片上的文字并右键,选择需要的选区格式。
- 如果要清理整张卡片,请先选中卡面文字,再选择菜单最下方的“全卡格式清除”。它处理当前笔记的全部字段;卡片空白处无选区右键继续使用 Anki 原生菜单。
新建挖空固定使用 {{c1::...}}。历史卡片中已有的 c2、c3 仍可识别和转换,但插件不会自动改写这些旧编号。
自定义按钮
可以在插件配置中修改 format_buttons。每个按钮支持:
label:菜单显示名称。
color:输出颜色,例如 #ff0000。
bold:1 表示加粗,0 表示不加粗。
action:可选;不填时插件会自动生成,重复时会自动补后缀。
“工具 -> Quick Format -> 挖空颜色同步”可控制混合选区中的挖空答案是否跟随颜色/加粗按钮。默认开启;关闭后只格式化普通文字,挖空答案保留原有颜色和粗细。单独选中一个完整挖空的转换行为不受影响。
挖空按钮不走配置,始终只保留一个。
重要限制
选区可以同时包含普通文字和一个或多个完整挖空答案。使用颜色/加粗按钮时,挖空语法和提示会保留;“挖空颜色同步”开启时答案跟随按钮样式,关闭时答案保留原有颜色和粗细,普通文字仍按按钮格式化。每个挖空都必须完整选中;只选挖空的一部分时会拒绝修改。
使用“黑色不加粗”时,完整挖空会被展开为普通文字并移除挖空标记和提示,选区内文字统一变为黑色、不加粗。单独选择一个完整挖空并使用其他颜色/加粗按钮时,沿用原有转换行为。
例如,选中 在这样的{{c1::自我怀疑}}中,我都想放弃写书的计划了 后点“黑色不加粗”,会保留可见句子并移除挖空标记和提示。
卡片正面显示的挖空占位文字有时无法映射回笔记原文;此时插件会给出安全提示并保持笔记不变。需要处理整张卡片时,请全选卡面后使用“黑色不加粗”。
安装
下载 .ankiaddon 文件,在 Anki 中打开“工具 -> 插件 -> 从文件安装”,选择该文件,然后完整退出并重新启动 Anki。
隐私
插件只在本地处理卡片内容,不上传笔记、卡片或选中文本,也不使用网络服务。
English Description
Quick Format
Quick Format adds a right-click formatting menu to the Anki reviewer. While reviewing a card, select text, right-click, and apply color, bold styling, or a Cloze deletion without opening the note editor.
Features
- Format selected review text directly from a context menu.
- User-configurable formatting buttons in
config.json, including label, color, and bold setting.
- Default menu order: Red Bold, Cloze, Blue Regular, Green Regular, Purple Regular, Pink Regular, Black Regular, Black Bold, and Clear All Card Formatting.
- Selecting all visible card text and choosing “Black Regular” normalizes every field in the current note, removes Cloze markup and hints, and makes text black and regular weight.
- The Quick Format menu appears only when text is selected. Its final “Clear All Card Formatting” action removes Cloze markup, hints, and common text styles from every field, makes text black and regular weight, and preserves images, links, and layout. Right-clicking a blank card area with no selection keeps Anki’s native context menu.
- Cards generated from the same note share its fields, so either whole-note action also affects those sibling cards.
- The Cloze action always creates
{{c1::...}}; it does not auto-increment to c2 or c3.
- A selection may include ordinary text and one or more complete Cloze answers. Color/bold buttons preserve Cloze markup and hints; the “Cloze Color Sync” setting controls whether the answers follow the button style. When it is off, ordinary text is formatted while Cloze answers keep their original color and weight.
- “Black Regular” converts all selected text, including complete Cloze answers, into black, regular plain text and removes Cloze markup and hints.
- Convert one complete existing Cloze deletion directly into any configured non-Cloze formatting style when selected on its own.
- Toggle Cloze answer style syncing from Tools -> Quick Format -> “挖空颜色同步” (Cloze Color Sync). It is enabled by default; when disabled, Cloze answers in mixed selections keep their original color and weight while ordinary text follows the selected button.
- The Tools -> Quick Format submenu contains “挖空颜色同步” (Cloze Color Sync), “使用说明” (Usage), and “关于” (About), in that order.
- Handles fields with HTML tags, HTML entities, line breaks, repeated whitespace, and repeated text more reliably.
- Ordinary formatting selections can include spaces and cross safe paragraph boundaries while preserving the existing layout.
- Preserves line breaks in formatted selections as HTML
<br> breaks.
- Text previously formatted by Quick Format can be selected together with adjacent plain text and reformatted again.
- Anki undo protection is enabled by default; whole-note actions create a checkpoint only when field content changes.
Usage
- Select text on a card and right-click to apply a selection-based format.
- To clear the whole note, select any card text, right-click, and choose “Clear All Card Formatting” at the bottom. The action updates every field in the current note. Right-clicking a blank card area with no selection keeps Anki’s native context menu.
New Cloze deletions always use {{c1::...}}. Existing c2 or c3 markup remains supported for matching and conversion, but Quick Format does not rewrite old Cloze numbers automatically.
Custom Buttons
You can edit format_buttons in the add-on configuration. Each button supports:
label: menu label.
color: output color, such as #ff0000.
bold: 1 for bold, 0 for regular.
action: optional; if omitted, Quick Format generates one automatically and de-duplicates repeated values.
Use Tools -> Quick Format -> “挖空颜色同步” to disable Cloze answer formatting in mixed selections. Disabled answers keep their existing color and weight; converting one Cloze selected by itself is unchanged.
The Cloze button is not configurable and remains a single fixed action.
Important Limitation
When selecting ordinary text together with one or more Cloze answers, include every selected answer in full. Color/bold buttons preserve the Cloze wrapper and hint; with Cloze Color Sync enabled, answers follow the selected button style. When syncing is disabled, Quick Format formats ordinary text and leaves the Cloze answer HTML unchanged. “Black Regular” removes complete Cloze wrappers and hints, then turns all selected text black and regular. A selection that cuts through an answer is rejected to protect the note.
Selecting exactly one complete Cloze by itself retains the existing conversion behavior and removes its Cloze markup when applying a normal format. “Black Regular” also converts mixed ordinary text and complete Cloze answers into plain text.
A Cloze placeholder shown on the front of a card may not map back to the note source. Quick Format reports a safe action and leaves the note unchanged; select the whole card before using “Black Regular” when whole-note cleanup is intended.
Installation
Download the .ankiaddon file. In Anki, open “Tools -> Add-ons -> Install from file”, select the file, then fully quit and restart Anki.
Privacy
All processing happens locally. The add-on does not upload notes, cards, or selected text and does not use any network service.