NoteAtom
是笔记的原子 结构。一个 NoteAtom
节点,可以包含其他的NoteAtom
节点,以一个树状的结构来描述一篇笔记。NoteAtom
可以包含如下属性:属性 | 类型 | 说明 |
---|---|---|
type | string | 表示当前 atom 节点的类型,可能包含 doc(一篇笔记) paragraph(笔记中的段落) text(段落中的文本) 等类型。⚠️ 根节点的 type 必须是 doc |
text | string | 节点的文本内容 |
marks | []NoteAtom | 由多个atom 节点组成,通常用来修饰 text 文本的样式,如高亮 加粗 链接 |
attrs | map<string>string | 节点的属性 |
content | []NoteAtom | 当前节点的子节点,由多个atom 节点组成。譬如一个doc 节点包含多个 paragraph 节点, paragraph 又可以包含多个 text 节点 |
{
"type": "doc",
"content": [
{
"content": [
{
"text": "这是一条 API 创建的笔记",
"type": "text"
}
],
"type": "paragraph"
},
{
"type": "paragraph"
},
{
"content": [
{
"text": "第一段,普通文本段落",
"type": "text"
}
],
"type": "paragraph"
},
{
"type": "paragraph"
},
{
"content": [
{
"text": "第二段,富文本段落 ",
"type": "text"
},
{
"marks": [
{
"type": "bold"
}
],
"text": "加粗",
"type": "text"
},
{
"text": " ",
"type": "text"
},
{
"marks": [
{
"type": "highlight"
}
],
"text": "高亮",
"type": "text"
},
{
"text": " ",
"type": "text"
},
{
"marks": [
{
"attrs": {
"href": "https://baidu.com"
},
"type": "link"
}
],
"text": "链接",
"type": "text"
}
],
"type": "paragraph"
},
{
"type": "paragraph"
},
{
"attrs": {
"align": "center",
"alt": "第二段与第三段之间插入一张图",
"uuid": "iLg8nJvIhexM-VxBHjXYZ-TMP"
},
"type": "image"
},
{
"type": "paragraph"
},
{
"content": [
{
"text": "第三段,富文本段落 ",
"type": "text"
},
{
"marks": [
{
"attrs": {
"href": "https://bing.com"
},
"type": "link"
},
{
"type": "highlight"
},
{
"type": "bold"
}
],
"text": "加粗并高亮的链接",
"type": "text"
}
],
"type": "paragraph"
},
{
"type": "paragraph"
},
{
"attrs": {
"audio-uuid": "iLg8nJvIhexM-VxBHjXYZ-TMP",
"show-note": "00:00 这里是音频 ShowNote\n02:00 开头\n04:00 结尾"
},
"type": "audio"
},
{
"type": "paragraph"
},
{
"content": [
{
"text": "第四段,引用文本段落",
"type": "text"
}
],
"type": "quote"
},
{
"type": "paragraph"
},
{
"content": [
{
"text": "第五段,引用文本段落也可以有富文本 ",
"type": "text"
},
{
"marks": [
{
"attrs": {
"href": "https://bing.com"
},
"type": "link"
},
{
"type": "highlight"
},
{
"type": "bold"
}
],
"text": "加粗并高亮的链接",
"type": "text"
}
],
"type": "quote"
},
{
"type": "paragraph"
},
{
"attrs": {
"uuid": "pnYaQHZpippbfleHTrVa-"
},
"type": "note"
},
{
"attrs": {
"uuid": "ew6POhwnucrXmWNRTuXYZ-TMP"
},
"type": "pdf"
}
]
}