模式 · PATTERN
笔记标注块 Callouts
课程笔记用 Obsidian 的语法和官方色板:老用户零学习成本,一眼分清提示、警告和完成。这是刻意的边界——笔记区是内容,不是产品界面。
本节要点
把收集、整理、输出三件事拆开做,每一步只解决一个问题。
- 收集:先存,不分类
- 整理:每周一次,按项目归档
- 输出:一篇笔记只回答一个问题
- 建好收件箱
- 每周整理一次
| 阶段 | 频率 | 产出 |
|---|---|---|
| 收集 | 随时 | 收件箱 |
| 整理 | 每周 | 项目笔记 |
// 围栏代码块:缩进逐字保真,右上角一键复制
function inbox(note) {
return { ...note, tags: [] }
}import { MarkdownNotes } from './components/v4/MarkdownNotes.jsx'
const MD = `## 本节要点
把收集、整理、输出三件事拆开做,每一步只解决一个问题。
- 收集:先存,不分类
- 整理:每周一次,按项目归档
- 输出:一篇笔记只回答一个问题
> [!note] 笔记
> 标注块语法与 Obsidian 完全一致,老用户零学习成本。
> [!tip] 技巧
> 在笔记里写 \`[跳到第 3 节](#jump:demo-3)\` 会生成朱色跳转胶囊。
> [!warning]- 注意(点我展开)
> 折叠标注块默认收起,标题后加 \`-\` 即可。
- [x] 建好收件箱
- [ ] 每周整理一次
> [!success] 完成
> 看完这节,你应该能搭出自己的收件箱。
| 阶段 | 频率 | 产出 |
|---|---|---|
| 收集 | 随时 | 收件箱 |
| 整理 | 每周 | 项目笔记 |
\`\`\`js
// 围栏代码块:缩进逐字保真,右上角一键复制
function inbox(note) {
return { ...note, tags: [] }
}
\`\`\`
`
export default function CalloutsDemo() {
return (
<div style={{ width: '100%', maxWidth: 560, background: '#FFFFFF', padding: '8px 4px' }}>
<MarkdownNotes md={MD} onJump={() => {}} />
</div>
)
}<div style="width: 100%; max-width: 560px; background: #ffffff; padding: 8px 4px">
<div style="max-width: 720px">
<h4
style="
margin: 24px 0 8px;
font-size: 15px;
font-weight: 700;
line-height: 24px;
color: var(--zzm-ink);
"
>
<span>本节要点</span>
</h4>
<p style="margin: 8px 0; font-size: 13.5px; line-height: 24px; color: var(--zzm-text-2)">
<span>把收集、整理、输出三件事拆开做,每一步只解决一个问题。</span>
</p>
<ul style="margin: 8px 0 12px; padding-left: 20px; list-style-type: disc">
<li style="font-size: 13.5px; line-height: 24px; color: var(--zzm-text-2); margin-top: 0">
<span><span>收集:先存,不分类</span></span>
</li>
<li style="font-size: 13.5px; line-height: 24px; color: var(--zzm-text-2); margin-top: 4px">
<span><span>整理:每周一次,按项目归档</span></span>
</li>
<li style="font-size: 13.5px; line-height: 24px; color: var(--zzm-text-2); margin-top: 4px">
<span><span>输出:一篇笔记只回答一个问题</span></span>
</li>
</ul>
<div
class="zzm-callout"
style="
margin: 12px 0;
border-radius: 0 8px 8px 0;
overflow: hidden;
border-left: 3px solid rgb(8, 109, 221);
background: rgba(8, 109, 221, 0.05);
--zzm-callout-rgb: 8, 109, 221;
"
>
<div
style="
display: flex;
align-items: center;
gap: 8px;
padding: 12px 16px 8px;
cursor: default;
user-select: auto;
"
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="15"
height="15"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="lucide lucide-pencil zzm-callout-ink"
aria-hidden="true"
style="color: rgb(8, 109, 221); flex: none"
>
<path
d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
></path>
<path d="m15 5 4 4"></path>
</svg>
<span
class="zzm-callout-ink"
style="
flex: 1;
font-size: 13px;
font-weight: 650;
line-height: 20px;
color: rgb(8, 109, 221);
"
>
<span>笔记</span>
</span>
</div>
<div style="padding: 0 16px 12px">
<p style="margin: 4px 0; font-size: 13.5px; line-height: 24px; color: var(--zzm-text-2)">
<span>标注块语法与 Obsidian 完全一致,老用户零学习成本。</span>
</p>
</div>
</div>
<div
class="zzm-callout"
style="
margin: 12px 0;
border-radius: 0 8px 8px 0;
overflow: hidden;
border-left: 3px solid rgb(0, 191, 188);
background: rgba(0, 191, 188, 0.05);
--zzm-callout-rgb: 0, 191, 188;
"
>
<div
style="
display: flex;
align-items: center;
gap: 8px;
padding: 12px 16px 8px;
cursor: default;
user-select: auto;
"
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="15"
height="15"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="lucide lucide-flame zzm-callout-ink"
aria-hidden="true"
style="color: rgb(0, 191, 188); flex: none"
>
<path
d="M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4"
></path>
</svg>
<span
class="zzm-callout-ink"
style="
flex: 1;
font-size: 13px;
font-weight: 650;
line-height: 20px;
color: rgb(0, 191, 188);
"
>
<span>技巧</span>
</span>
</div>
<div style="padding: 0 16px 12px">
<p style="margin: 4px 0; font-size: 13.5px; line-height: 24px; color: var(--zzm-text-2)">
<span>在笔记里写</span>
<code
style="
font-family: var(--zzm-mono);
font-size: 0.88em;
background: var(--zzm-fill-2);
padding: 1px 5px;
border-radius: 4px;
word-break: break-word;
"
>
[跳到第 3 节](#jump:demo-3)
</code>
<span>会生成朱色跳转胶囊。</span>
</p>
</div>
</div>
<div
class="zzm-callout"
style="
margin: 12px 0;
border-radius: 0 8px 8px 0;
overflow: hidden;
border-left: 3px solid rgb(236, 117, 0);
background: rgba(236, 117, 0, 0.05);
--zzm-callout-rgb: 236, 117, 0;
"
>
<div
style="
display: flex;
align-items: center;
gap: 8px;
padding: 12px 16px;
cursor: pointer;
user-select: none;
"
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="15"
height="15"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="lucide lucide-triangle-alert lucide-alert-triangle zzm-callout-ink"
aria-hidden="true"
style="color: rgb(236, 117, 0); flex: none"
>
<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"></path>
<path d="M12 9v4"></path>
<path d="M12 17h.01"></path>
</svg>
<span
class="zzm-callout-ink"
style="
flex: 1;
font-size: 13px;
font-weight: 650;
line-height: 20px;
color: rgb(236, 117, 0);
"
>
<span>注意(点我展开)</span>
</span>
<svg
xmlns="http://www.w3.org/2000/svg"
width="14"
height="14"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="lucide lucide-chevron-right zzm-callout-ink"
aria-hidden="true"
style="
flex: none;
color: rgb(236, 117, 0);
opacity: 0.7;
transform: none;
transition: transform 0.15s ease;
"
>
<path d="m9 18 6-6-6-6"></path>
</svg>
</div>
</div>
<ul style="margin: 8px 0 12px; padding-left: 20px; list-style-type: disc">
<li
style="
font-size: 13.5px;
line-height: 24px;
color: var(--zzm-text-2);
margin-top: 0;
list-style-type: none;
position: relative;
"
>
<span
role="img"
aria-label="已完成"
style="
position: absolute;
left: -20px;
top: 4px;
display: flex;
width: 16px;
height: 16px;
box-sizing: border-box;
border-radius: 4px;
align-items: center;
justify-content: center;
background: var(--zzm-ink-strong);
"
>
<svg width="10" height="10" viewBox="0 0 12 12" aria-hidden="true">
<path
d="M2 6.2 L4.8 9 L10 3.4"
fill="none"
stroke-width="1.8"
stroke-linecap="round"
stroke-linejoin="round"
style="stroke: var(--zzm-on-ink)"
></path>
</svg>
</span>
<span style="color: var(--zzm-muted); text-decoration: line-through">
<span>建好收件箱</span>
</span>
</li>
<li
style="
font-size: 13.5px;
line-height: 24px;
color: var(--zzm-text-2);
margin-top: 4px;
list-style-type: none;
position: relative;
"
>
<span
role="img"
aria-label="未完成"
style="
position: absolute;
left: -20px;
top: 4px;
display: flex;
width: 16px;
height: 16px;
box-sizing: border-box;
border-radius: 4px;
align-items: center;
justify-content: center;
border: 1.5px solid var(--zzm-faint);
"
></span>
<span><span>每周整理一次</span></span>
</li>
</ul>
<div
class="zzm-callout"
style="
margin: 12px 0;
border-radius: 0 8px 8px 0;
overflow: hidden;
border-left: 3px solid rgb(8, 185, 78);
background: rgba(8, 185, 78, 0.05);
--zzm-callout-rgb: 8, 185, 78;
"
>
<div
style="
display: flex;
align-items: center;
gap: 8px;
padding: 12px 16px 8px;
cursor: default;
user-select: auto;
"
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="15"
height="15"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="lucide lucide-check zzm-callout-ink"
aria-hidden="true"
style="color: rgb(8, 185, 78); flex: none"
>
<path d="M20 6 9 17l-5-5"></path>
</svg>
<span
class="zzm-callout-ink"
style="
flex: 1;
font-size: 13px;
font-weight: 650;
line-height: 20px;
color: rgb(8, 185, 78);
"
>
<span>完成</span>
</span>
</div>
<div style="padding: 0 16px 12px">
<p style="margin: 4px 0; font-size: 13.5px; line-height: 24px; color: var(--zzm-text-2)">
<span>看完这节,你应该能搭出自己的收件箱。</span>
</p>
</div>
</div>
<div style="margin: 12px 0; overflow-x: auto; max-width: 100%">
<table style="border-collapse: collapse; font-size: 12.5px; min-width: 100%">
<thead>
<tr>
<th
style="
border: 1px solid var(--zzm-hairline-2, rgba(0, 0, 0, 0.09));
padding: 8px 12px;
font-size: 12.5px;
line-height: 20px;
color: var(--zzm-ink);
vertical-align: top;
background: var(--zzm-fill-lite);
font-weight: 650;
text-align: left;
white-space: nowrap;
"
>
<span>阶段</span>
</th>
<th
style="
border: 1px solid var(--zzm-hairline-2, rgba(0, 0, 0, 0.09));
padding: 8px 12px;
font-size: 12.5px;
line-height: 20px;
color: var(--zzm-ink);
vertical-align: top;
background: var(--zzm-fill-lite);
font-weight: 650;
text-align: left;
white-space: nowrap;
"
>
<span>频率</span>
</th>
<th
style="
border: 1px solid var(--zzm-hairline-2, rgba(0, 0, 0, 0.09));
padding: 8px 12px;
font-size: 12.5px;
line-height: 20px;
color: var(--zzm-ink);
vertical-align: top;
background: var(--zzm-fill-lite);
font-weight: 650;
text-align: left;
white-space: nowrap;
"
>
<span>产出</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<td
style="
border: 1px solid var(--zzm-hairline-2, rgba(0, 0, 0, 0.09));
padding: 8px 12px;
font-size: 12.5px;
line-height: 20px;
color: var(--zzm-text-2);
vertical-align: top;
text-align: left;
"
>
<span>收集</span>
</td>
<td
style="
border: 1px solid var(--zzm-hairline-2, rgba(0, 0, 0, 0.09));
padding: 8px 12px;
font-size: 12.5px;
line-height: 20px;
color: var(--zzm-text-2);
vertical-align: top;
text-align: left;
"
>
<span>随时</span>
</td>
<td
style="
border: 1px solid var(--zzm-hairline-2, rgba(0, 0, 0, 0.09));
padding: 8px 12px;
font-size: 12.5px;
line-height: 20px;
color: var(--zzm-text-2);
vertical-align: top;
text-align: left;
"
>
<span>收件箱</span>
</td>
</tr>
<tr>
<td
style="
border: 1px solid var(--zzm-hairline-2, rgba(0, 0, 0, 0.09));
padding: 8px 12px;
font-size: 12.5px;
line-height: 20px;
color: var(--zzm-text-2);
vertical-align: top;
text-align: left;
"
>
<span>整理</span>
</td>
<td
style="
border: 1px solid var(--zzm-hairline-2, rgba(0, 0, 0, 0.09));
padding: 8px 12px;
font-size: 12.5px;
line-height: 20px;
color: var(--zzm-text-2);
vertical-align: top;
text-align: left;
"
>
<span>每周</span>
</td>
<td
style="
border: 1px solid var(--zzm-hairline-2, rgba(0, 0, 0, 0.09));
padding: 8px 12px;
font-size: 12.5px;
line-height: 20px;
color: var(--zzm-text-2);
vertical-align: top;
text-align: left;
"
>
<span>项目笔记</span>
</td>
</tr>
</tbody>
</table>
</div>
<div style="position: relative; margin: 12px 0">
<pre
style="
margin: 0;
padding: 12px;
border-radius: 8px;
background: var(--zzm-input);
border: 1px solid var(--zzm-hairline-2, rgba(0, 0, 0, 0.09));
overflow-x: auto;
max-width: 100%;
"
><code style="font-family:var(--zzm-mono);font-size:12px;line-height:20px;color:var(--zzm-text-2);white-space:pre;display:block;width:max-content;min-width:100%"><span style="padding-right:32px">// 围栏代码块:缩进逐字保真,右上角一键复制</span>
function inbox(note) {
return { ...note, tags: [] }
}</code></pre>
<button
type="button"
class="zzm-btn zzm-btn--sm zzm-btn--icon"
title="复制代码"
aria-label="复制代码"
aria-live="polite"
style="position: absolute; top: 8px; right: 8px"
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="14"
height="14"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="lucide lucide-copy"
aria-hidden="true"
>
<rect width="14" height="14" x="8" y="8" rx="2" ry="2"></rect>
<path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path>
</svg>
</button>
</div>
</div>
</div>/* tokens.css · 用到的令牌 */
:root {
--zzm-ink: #E6E5DF;
--zzm-text-2: #C8C7C1;
--zzm-mono: ui-monospace, "SF Mono", Menlo, monospace;
--zzm-fill-2: rgba(255, 255, 255, 0.08);
--zzm-ink-strong: #EFEEE9;
--zzm-on-ink: #151514;
--zzm-muted: #8D8C86;
--zzm-faint: #4E4D49;
--zzm-hairline-2: rgba(255, 255, 255, 0.1);
--zzm-fill-lite: rgba(255, 255, 255, .035);
--zzm-input: #121211;
--zzm-key-line: rgba(255, 255, 255, .12);
--zzm-key-ink: #D6D5CF;
--zzm-key-face: linear-gradient(180deg, #2D2D2B 0%, #232322 100%);
--zzm-key-shadow: 0 0 0 3px rgba(255, 255, 255, .02), 0 1px 2px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .32), inset 0 1px 0 rgba(255, 255, 255, .07), inset 0 -1px 0 rgba(0, 0, 0, .3);
--zzm-key-line-hover: rgba(255, 255, 255, .2);
--zzm-key-shadow-hover: 0 0 0 4px rgba(255, 255, 255, .035), 0 2px 4px rgba(0, 0, 0, .5), 0 4px 12px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .09), inset 0 -1px 0 rgba(0, 0, 0, .3);
--zzm-key-face-active: linear-gradient(180deg, #1A1A19 0%, #212120 100%);
--zzm-key-shadow-active: 0 0 0 3px rgba(255, 255, 255, .02), 0 1px 0 rgba(255, 255, 255, .04), inset 0 2px 4px rgba(0, 0, 0, .55), inset 0 1px 2px rgba(0, 0, 0, .4);
--zzm-key-shadow-focus: 0 0 0 3px rgba(226, 125, 103, .35), 0 1px 2px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .32), inset 0 1px 0 rgba(255, 255, 255, .07);
--zzm-muted-2: #85847C;
--zzm-key-off: #1E1E1D;
--zzm-key-off-line: rgba(255, 255, 255, .06);
--zzm-key-off-shadow: none;
}
/* base.css */
.zzm-v4[data-theme="dark"] .zzm-callout { background: rgba(var(--zzm-callout-rgb), .09) !important; }
.zzm-v4[data-theme="dark"] .zzm-callout-ink { color: color-mix(in srgb, rgb(var(--zzm-callout-rgb)), #fff 32%) !important; }
/* controls.css */
.zzm-v4 .zzm-btn {
-webkit-appearance: none;
appearance: none;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
height: 36px;
padding: 0 16px;
font-family: inherit;
font-size: 13px;
font-weight: 600;
letter-spacing: .2px;
white-space: nowrap;
cursor: pointer;
user-select: none;
border-radius: 8px; /* 圆角矩形——按钮禁胶囊 */
border: 1px solid var(--zzm-key-line);
color: var(--zzm-key-ink);
background: var(--zzm-key-face);
box-shadow: var(--zzm-key-shadow); /* ④光晕 ③近影远影 ②顶部反光 ①底缘收沉 */
transition: box-shadow .16s ease, transform .16s ease, background .16s ease,
border-color .16s ease, filter .16s ease, opacity .16s ease;
}
.zzm-v4 .zzm-btn:hover {
transform: translateY(-1px);
border-color: var(--zzm-key-line-hover);
box-shadow: var(--zzm-key-shadow-hover);
}
.zzm-v4 .zzm-btn:active {
transform: translateY(0);
background: var(--zzm-key-face-active); /* ⑤ 凹面翻转 */
box-shadow: var(--zzm-key-shadow-active);
}
.zzm-v4 .zzm-btn:focus-visible {
outline: none;
box-shadow: var(--zzm-key-shadow-focus); /* 键盘焦点=朱色光晕 */
}
.zzm-v4 .zzm-btn:disabled {
cursor: not-allowed;
transform: none;
}
.zzm-v4 .zzm-btn:disabled:not(.zzm-btn--busy) {
color: var(--zzm-muted-2);
background: var(--zzm-key-off);
border-color: var(--zzm-key-off-line);
box-shadow: var(--zzm-key-off-shadow);
}
.zzm-v4 .zzm-btn--sm { height: 28px; padding: 0 12px; font-size: 12px; gap: 4px; }
.zzm-v4 .zzm-btn--icon { width: 36px; padding: 0; }
.zzm-v4 .zzm-btn--icon.zzm-btn--sm { width: 28px; }
.zzm-v4 .zzm-btn--icon.zzm-btn--lg { width: 44px; }
@media (pointer: coarse) {
.zzm-v4 .zzm-btn--sm:not(.zzm-btn--busy) { position: relative; }
}
@media (pointer: coarse) {
.zzm-v4 .zzm-btn--sm:not(.zzm-btn--busy)::after { content: ""; position: absolute; inset: -8px; }
}十三种标注块
| 类型 | 默认标题 | 色族 | RGB | 图标 |
|---|---|---|---|---|
note | Note | blue | 8, 109, 221 | Pencil |
abstract | Abstract | cyan | 0, 191, 188 | ClipboardList |
info | Info | blue | 8, 109, 221 | Info |
todo | Todo | blue | 8, 109, 221 | CheckCircle2 |
tip | Tip | cyan | 0, 191, 188 | Flame |
success | Success | green | 8, 185, 78 | Check |
question | Question | yellow | 224, 172, 0 | HelpCircle |
warning | Warning | orange | 236, 117, 0 | AlertTriangle |
failure | Failure | red | 233, 49, 71 | X |
danger | Danger | red | 233, 49, 71 | Zap |
bug | Bug | red | 233, 49, 71 | Bug |
example | Example | purple | 120, 82, 238 | List |
quote | Quote | mono | 90, 90, 86 | Quote |
类型大小写不敏感;未知类型回落到 note(与 Obsidian 一致)。别名:summary/tldr→abstract,hint/important→tip,check/done→success,help/faq→question,caution/attention→warning,fail/missing→failure,error→danger,cite→quote。标题后加 - 默认折叠、加 + 默认展开。
还支持
标题、段落、列表(含中文顿号 1、;圆点随层级 disc → circle → square,有序列表从首条序号起编,条目间空行不切断列表,条目下的缩进内容归属条目)、任务列表 - [ ] / - [x](无序里框替代圆点,有序里跟在序号后;只认空格与 x,自定义状态保留原文)、可横向滚动的表格、缩进逐字保真的围栏代码块(右上角复制键一键复制原文,点后显示「已复制」2 秒)、引用、裸链接自动识别、点击放大的图片,以及 [文字](#jump:课节ID) 朱色跳转胶囊——点它跳到对应课节。
铁律
✓ 要笔记区(内容)用 Obsidian 官方色
✗ 不要把这些颜色带进按钮、卡片、徽章等产品界面
✓ 要链接没通过白名单(safeHref)时降级为纯文本
✓ 要代码块复制键是 pre 的兄弟元素:横向滚动时钉在右上角,框选代码选不进按钮字