冰块1 downloadsInline todos anywhere in a line: []text/ and [x]text/. Multi-line content, native Markdown inside, click to toggle, source reveals on cursor, skipped in code, JS API for other plugins.
English | 中文说明见下方
Checkable inline todos anywhere in a line for Obsidian — not just at the start of a list item.
Buy groceries[]milk /[]bread /[x]report done/
A todo can also span[]several lines
within the same paragraph,
until the slash/ and normal text continues here.
[]text/ = unchecked, [x]text/ = checked (strikethrough). The todo only covers the text between the markers.[] ↔ [x]).[]text/ so you can edit it, like native Markdown syntax does.[] or / never renders.\/.| Syntax | Meaning |
|---|---|
[]text/ |
unchecked inline todo |
[x]text/ |
checked inline todo (strikethrough) |
\/ inside content |
literal / |
| (single line break inside) | keeps the todo open (same paragraph only) |
main.js, manifest.json, styles.css from the latest release into <vault>/.obsidian/plugins/inline-todo/ and enable it.The plugin exposes a public API so other plugins and scripts can read inline todos (they are not list items, so the Tasks plugin / Dataview task lists will not see them — use this API instead):
const api = app.plugins.plugins['inline-todo']?.api;
// All inline todos of one note (in document order)
const todos = await api.getTodos('notes/today.md');
// [{ checked: false, text: 'milk', raw: '[]milk /', index: 12, line: 3, column: 4 }, ...]
// Scan the whole vault: { 'path/to/note.md': [todos...] }
const all = await api.getAll();
// Subscribe to toggles (callback receives the file path)
const ref = api.onChanged((path) => console.log('changed:', path));
// app.workspace.offref(ref) to unsubscribe
DataviewJS example — count open inline todos per note:
const api = app.plugins.plugins['inline-todo']?.api;
const all = await api.getAll();
const rows = Object.entries(all).map(([path, todos]) => ({
note: path,
open: todos.filter(t => !t.checked).length,
done: todos.filter(t => t.checked).length,
}));
dv.table(['note', 'open', 'done'], rows.map(r => [r.note, r.open, r.done]));
在 Obsidian 里让一行中的任意位置都能放可勾选的待办,不再受“待办必须是列表项”的限制。
买菜[]牛奶 /[]面包 /[x]周报写完了/
待办也可以[]跨行书写,
只要在同一个段落内,
到斜杠为止/ 后面就恢复普通文字。
| 写法 | 含义 |
|---|---|
[]内容/ |
未完成待办 |
[x]内容/ |
已完成待办(内容自动划删除线) |
内容里的 \/ |
字面斜杠 / |
| 段落内换行 | 待办继续,跨段落不行 |
[] ↔ [x])[] 也不会行内待办不是列表任务,所以 Tasks、Dataview 的任务列表默认看不到它们。本插件提供公开 API:
const api = app.plugins.plugins['inline-todo']?.api;
await api.getTodos('笔记.md'); // 该笔记全部行内待办
await api.getAll(); // 全库扫描 { 路径: 待办数组 }
api.onChanged(path => { ... }); // 监听勾选变化
每个待办对象包含:checked(是否完成)、text(内容,已还原转义)、index(源文偏移)、line / column(行/列,从 0 计)。
DataviewJS 统计示例见上文 English 部分。