📝 API 渲染模板
文档描述 Fix https://github.com/siyuan-note/siyuan/issues/5538
This commit is contained in:
parent
236ffd8e64
commit
35acea7332
2 changed files with 47 additions and 3 deletions
24
API.md
24
API.md
|
@ -808,7 +808,29 @@ View API token in <kbd>Settings - About</kbd>, request header: `Authorization: T
|
|||
|
||||
### Render a template
|
||||
|
||||
/api/template/render
|
||||
* `/api/template/render`
|
||||
* Parameters
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "20220724223548-j6g0o87",
|
||||
"path": "F:\\SiYuan\\data\\templates\\foo.md"
|
||||
}
|
||||
```
|
||||
* `id`: The ID of the document where the rendering is called
|
||||
* `path`: Template file absolute path
|
||||
* Return value
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 0,
|
||||
"msg": "",
|
||||
"data": {
|
||||
"content": "<div data-node-id=\"20220729234848-dlgsah7\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20220729234840\"><div contenteditable=\"true\" spellcheck=\"false\">foo</div><div class=\"protyle-attr\" contenteditable=\"false\"></div></div>",
|
||||
"path": "F:\\SiYuan\\data\\templates\\foo.md"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## File
|
||||
|
||||
|
|
26
API_zh_CN.md
26
API_zh_CN.md
|
@ -703,7 +703,7 @@
|
|||
}
|
||||
```
|
||||
|
||||
* `id`:待获取块的 ID
|
||||
* `id`:待获取块的 ID
|
||||
* 返回值
|
||||
|
||||
```json
|
||||
|
@ -803,7 +803,29 @@
|
|||
|
||||
### 渲染模板
|
||||
|
||||
/api/template/render
|
||||
* `/api/template/render`
|
||||
* 参数
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "20220724223548-j6g0o87",
|
||||
"path": "F:\\SiYuan\\data\\templates\\foo.md"
|
||||
}
|
||||
```
|
||||
* `id`:调用渲染所在的文档 ID
|
||||
* `path`:模板文件绝对路径
|
||||
* 返回值
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 0,
|
||||
"msg": "",
|
||||
"data": {
|
||||
"content": "<div data-node-id=\"20220729234848-dlgsah7\" data-node-index=\"1\" data-type=\"NodeParagraph\" class=\"p\" updated=\"20220729234840\"><div contenteditable=\"true\" spellcheck=\"false\">foo</div><div class=\"protyle-attr\" contenteditable=\"false\"></div></div>",
|
||||
"path": "F:\\SiYuan\\data\\templates\\foo.md"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 文件
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue