/api/export
exportHTML
- 🛠 获取文档块 HTML 导出文本
/api/export/exportHTML
请求
ts
/**
* Exports the specified document block as HTML
*/
export interface IPayload {
/**
* doc block ID
*/
readonly id: string;
/**
* Whether to keep the folding state
*/
readonly keepFold?: boolean;
/**
* Whether to merge the content of the sub-document
*/
readonly merge?: boolean;
/**
* Whether the export format is PDF
*/
readonly pdf: boolean;
/**
* The location where the file is saved
*/
readonly savePath: string;
}
json5
/**
* schemas/kernel/api/export/exportHTML/payload.schema.json5
* 导出指定文档块为 HTML
* REF: https://github.com/siyuan-note/siyuan/blob/v3.0.7/kernel/api/export.go#L419-L436
* @pathname: /api/export/exportHTML
* @version: 3.0.7
*/
{
$schema: 'https://json-schema.org/draft/2020-12/schema',
$id: 'https://github.com/siyuan-community/siyuan-sdk/raw/main/schemas/kernel/api/export/exportHTML/payload.schema.json5',
$comment: 'v3.0.7',
$ref: '#/$defs/root',
$defs: {
root: {
title: 'payload body',
description: 'Exports the specified document block as HTML',
type: 'object',
additionalProperties: false,
required: [
'id',
'pdf',
'savePath',
],
properties: {
id: {
// 要导出的块 ID
type: 'string',
description: 'doc block ID',
pattern: '^\\d{14}-[0-9a-z]{7}$',
},
pdf: {
// 是否导出玩 PDF
type: 'boolean',
description: 'Whether the export format is PDF',
},
savePath: {
// 导出时创建的文件的位置
type: 'string',
description: 'The location where the file is saved',
},
keepFold: {
// 是否保持折叠状态
type: 'boolean',
description: 'Whether to keep the folding state',
default: false,
},
merge: {
// 是否合并下级文档内容
type: 'boolean',
description: 'Whether to merge the content of the sub-document',
default: false,
},
},
},
},
}
json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/siyuan-community/siyuan-sdk/raw/main/schemas/kernel/api/export/exportHTML/payload.schema.json",
"$comment": "v3.0.7",
"$ref": "#/$defs/root",
"$defs": {
"root": {
"title": "payload body",
"description": "Exports the specified document block as HTML",
"type": "object",
"additionalProperties": false,
"required": [
"id",
"pdf",
"savePath"
],
"properties": {
"id": {
"type": "string",
"description": "doc block ID",
"pattern": "^\\d{14}-[0-9a-z]{7}$"
},
"pdf": {
"type": "boolean",
"description": "Whether the export format is PDF"
},
"savePath": {
"type": "string",
"description": "The location where the file is saved"
},
"keepFold": {
"type": "boolean",
"description": "Whether to keep the folding state",
"default": false
},
"merge": {
"type": "boolean",
"description": "Whether to merge the content of the sub-document",
"default": false
}
}
}
}
}
响应
ts
/**
* Exports the specified document block as HTML
*/
export interface IResponse {
/**
* status code
*/
readonly code: number;
readonly data: IData;
/**
* status message
*/
readonly msg: string;
}
/**
* exported content
*/
export interface IData {
/**
* html content
*/
readonly content: string;
/**
* doc block ID
*/
readonly id: string;
/**
* html name
*/
readonly name: string;
}
json5
/**
* schemas/kernel/api/export/exportHTML/response.schema.json5
* 导出指定文档块为 HTML
* REF: https://github.com/siyuan-note/siyuan/blob/v3.0.7/kernel/api/export.go#L419-L436
* @pathname: /api/export/exportHTML
* @version: 3.0.7
*/
{
$schema: 'https://json-schema.org/draft/2020-12/schema',
$id: 'https://github.com/siyuan-community/siyuan-sdk/raw/main/schemas/kernel/api/export/exportHTML/response.schema.json5',
$comment: 'v3.0.7',
$ref: '#/$defs/root',
$defs: {
root: {
title: 'response body',
description: 'Exports the specified document block as HTML',
type: 'object',
additionalProperties: false,
required: [
'code',
'msg',
'data',
],
properties: {
code: {
type: 'integer',
description: 'status code',
},
msg: {
type: 'string',
description: 'status message',
},
data: {
$ref: '#/$defs/data',
},
},
},
data: {
title: 'IData',
description: 'exported content',
type: 'object',
additionalProperties: false,
required: [
'id',
'name',
'content',
],
properties: {
id: {
type: 'string',
description: 'doc block ID',
pattern: '^\\d{14}-[0-9a-z]{7}$',
},
name: {
type: 'string',
description: 'html name',
},
content: {
type: 'string',
description: 'html content',
},
},
},
},
}
json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/siyuan-community/siyuan-sdk/raw/main/schemas/kernel/api/export/exportHTML/response.schema.json",
"$comment": "v3.0.7",
"$ref": "#/$defs/root",
"$defs": {
"root": {
"title": "response body",
"description": "Exports the specified document block as HTML",
"type": "object",
"additionalProperties": false,
"required": [
"code",
"msg",
"data"
],
"properties": {
"code": {
"type": "integer",
"description": "status code"
},
"msg": {
"type": "string",
"description": "status message"
},
"data": {
"$ref": "#/$defs/data"
}
}
},
"data": {
"title": "IData",
"description": "exported content",
"type": "object",
"additionalProperties": false,
"required": [
"id",
"name",
"content"
],
"properties": {
"id": {
"type": "string",
"description": "doc block ID",
"pattern": "^\\d{14}-[0-9a-z]{7}$"
},
"name": {
"type": "string",
"description": "html name"
},
"content": {
"type": "string",
"description": "html content"
}
}
}
}
}
exportMdContent
- 🔥 获取文档块 Markdown 导出文本
/api/export/exportMdContent
请求
ts
/**
* Exports the specified document block as Markdown
*/
export interface IPayload {
/**
* doc block ID
*/
readonly id: string;
}
json5
/**
* schemas/kernel/api/export/exportMdContent/payload.schema.json5
* 导出指定文档块为 Markdown
* REF: https://github.com/siyuan-note/siyuan/blob/master/API.md#export-markdown
* REF: https://github.com/siyuan-note/siyuan/blob/v2.9.2/kernel/api/export.go#L311-L330
* @pathname: /api/export/exportMdContent
* @version: 2.9.2
*/
{
$schema: 'https://json-schema.org/draft/2020-12/schema',
$id: 'https://github.com/siyuan-community/siyuan-sdk/raw/main/schemas/kernel/api/export/exportMdContent/payload.schema.json5',
$comment: 'v2.9.2',
$ref: '#/$defs/root',
$defs: {
root: {
title: 'payload body',
description: 'Exports the specified document block as Markdown',
type: 'object',
additionalProperties: false,
required: [
'id',
],
properties: {
id: {
type: 'string',
description: 'doc block ID',
pattern: '^\\d{14}-[0-9a-z]{7}$',
},
},
},
},
}
json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/siyuan-community/siyuan-sdk/raw/main/schemas/kernel/api/export/exportMdContent/payload.schema.json",
"$comment": "v2.9.2",
"$ref": "#/$defs/root",
"$defs": {
"root": {
"title": "payload body",
"description": "Exports the specified document block as Markdown",
"type": "object",
"additionalProperties": false,
"required": [
"id"
],
"properties": {
"id": {
"type": "string",
"description": "doc block ID",
"pattern": "^\\d{14}-[0-9a-z]{7}$"
}
}
}
}
}
响应
ts
/**
* Exports the specified document block as Markdown
*/
export interface IResponse {
/**
* status code
*/
readonly code: number;
readonly data: IData;
/**
* status message
*/
readonly msg: string;
}
/**
* exported content
*/
export interface IData {
/**
* Markdown content
*/
readonly content: string;
/**
* human friendly path (relative to the notebook directory)
*/
readonly hPath: string;
}
json5
/**
* schemas/kernel/api/export/exportMdContent/response.schema.json5
* 导出指定文档块为 Markdown
* REF: https://github.com/siyuan-note/siyuan/blob/master/API.md#export-markdown
* REF: https://github.com/siyuan-note/siyuan/blob/v2.9.2/kernel/api/export.go#L311-L330
* @pathname: /api/export/exportMdContent
* @version: 2.9.2
*/
{
$schema: 'https://json-schema.org/draft/2020-12/schema',
$id: 'https://github.com/siyuan-community/siyuan-sdk/raw/main/schemas/kernel/api/export/exportMdContent/response.schema.json5',
$comment: 'v2.9.2',
$ref: '#/$defs/root',
$defs: {
root: {
title: 'response body',
description: 'Exports the specified document block as Markdown',
type: 'object',
additionalProperties: false,
required: [
'code',
'msg',
'data',
],
properties: {
code: {
type: 'integer',
description: 'status code',
},
msg: {
type: 'string',
description: 'status message',
},
data: {
$ref: '#/$defs/data',
},
},
},
data: {
title: 'IData',
description: 'exported content',
type: 'object',
additionalProperties: false,
required: [
'content',
'hPath',
],
properties: {
hPath: {
type: 'string',
description: 'human friendly path (relative to the notebook directory)',
pattern: '^(/[^/]+)+$',
},
content: {
type: 'string',
description: 'Markdown content',
},
},
},
},
}
json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/siyuan-community/siyuan-sdk/raw/main/schemas/kernel/api/export/exportMdContent/response.schema.json",
"$comment": "v2.9.2",
"$ref": "#/$defs/root",
"$defs": {
"root": {
"title": "response body",
"description": "Exports the specified document block as Markdown",
"type": "object",
"additionalProperties": false,
"required": [
"code",
"msg",
"data"
],
"properties": {
"code": {
"type": "integer",
"description": "status code"
},
"msg": {
"type": "string",
"description": "status message"
},
"data": {
"$ref": "#/$defs/data"
}
}
},
"data": {
"title": "IData",
"description": "exported content",
"type": "object",
"additionalProperties": false,
"required": [
"content",
"hPath"
],
"properties": {
"hPath": {
"type": "string",
"description": "human friendly path (relative to the notebook directory)",
"pattern": "^(/[^/]+)+$"
},
"content": {
"type": "string",
"description": "Markdown content"
}
}
}
}
}
exportResources
- 🔥 导出资源文件
/api/export/exportResources
请求
ts
/**
* Packages the specified files and folders as *.zip files and returns their download
* addresses
*/
export interface IPayload {
/**
* main name of the zip file created
*/
readonly name?: string;
/**
* path list of files and folders
*/
readonly paths: string[];
}
json5
/**
* schemas/kernel/api/export/exportResources/payload.schema.json5
* 将指定的文件与文件夹打包为 *.zip 文件并返回其下载地址
* REF: https://github.com/siyuan-note/siyuan/blob/v2.9.8/kernel/api/export.go#L244-L278
* @pathname: /api/export/exportResources
* @version: 2.9.8
*/
{
$schema: 'https://json-schema.org/draft/2020-12/schema',
$id: 'https://github.com/siyuan-community/siyuan-sdk/raw/main/schemas/kernel/api/export/exportResources/payload.schema.json5',
$comment: 'v2.9.8',
$ref: '#/$defs/root',
$defs: {
root: {
title: 'payload body',
description: 'Packages the specified files and folders as *.zip files and returns their download addresses',
type: 'object',
additionalProperties: false,
required: [
'paths',
],
properties: {
paths: {
// 文件/文件夹路径列表
type: 'array',
description: 'path list of files and folders',
items: {
type: 'string',
},
examples: [
[
'/conf/appearance/boot', // 相对于工作空间目录的文件夹路径
'conf/appearance/langs', // 相对于工作空间目录的文件夹路径
'/conf/appearance/emojis/conf.json', // 相对于工作空间目录的文件路径
'conf/appearance/icons/index.html', // 相对于工作空间目录的文件路径
],
],
},
name: {
// 生成的压缩包文件名称
type: 'string',
description: 'main name of the zip file created',
default: 'export-YYYY-MM-DD_hh-mm-ss', // export-2023-07-28_15-05-49.zip
},
},
},
},
}
json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/siyuan-community/siyuan-sdk/raw/main/schemas/kernel/api/export/exportResources/payload.schema.json",
"$comment": "v2.9.8",
"$ref": "#/$defs/root",
"$defs": {
"root": {
"title": "payload body",
"description": "Packages the specified files and folders as *.zip files and returns their download addresses",
"type": "object",
"additionalProperties": false,
"required": [
"paths"
],
"properties": {
"paths": {
"type": "array",
"description": "path list of files and folders",
"items": {
"type": "string"
},
"examples": [
[
"/conf/appearance/boot",
"conf/appearance/langs",
"/conf/appearance/emojis/conf.json",
"conf/appearance/icons/index.html"
]
]
},
"name": {
"type": "string",
"description": "main name of the zip file created",
"default": "export-YYYY-MM-DD_hh-mm-ss"
}
}
}
}
}
响应
ts
/**
* Packages the specified files and folders as *.zip files and returns their download
* addresses
*/
export interface IResponse {
/**
* status code
*/
readonly code: number;
readonly data: IData;
/**
* status message
*/
readonly msg: string;
}
/**
* response data
*/
export interface IData {
/**
* the path of *.zip exported under the workspace
*/
readonly path: string;
}
json5
/**
* schemas/kernel/api/export/exportResources.schema.json5
* 将指定的文件与文件夹打包为 *.zip 文件并返回其下载地址
* REF: https://github.com/siyuan-note/siyuan/blob/v2.9.8/kernel/api/export.go#L244-L278
* @pathname: /api/export/exportResources
* @version: 2.9.8
*/
{
$schema: 'https://json-schema.org/draft/2020-12/schema',
$id: 'https://github.com/siyuan-community/siyuan-sdk/raw/main/schemas/kernel/api/export/exportResources/response.schema.json5',
$comment: 'v2.9.8',
$ref: '#/$defs/root',
$defs: {
root: {
title: 'payload body',
description: 'Packages the specified files and folders as *.zip files and returns their download addresses',
type: 'object',
additionalProperties: false,
required: [
'code',
'msg',
'data',
],
properties: {
code: {
type: 'integer',
description: 'status code',
},
msg: {
type: 'string',
description: 'status message',
},
data: {
$ref: '#/$defs/data',
},
},
},
data: {
title: 'IData',
description: 'response data',
type: 'object',
additionalProperties: false,
required: [
'path',
],
properties: {
path: {
// 生成的压缩包相对于工作空间目录的路径
type: 'string',
description: 'the path of *.zip exported under the workspace',
examples: [
'temp/export/custom-file-name.zip', // 自定义的文件名
'temp/export/export-2023-07-28_15-05-49.zip', // 默认文件名
],
},
},
},
},
}
json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/siyuan-community/siyuan-sdk/raw/main/schemas/kernel/api/export/exportResources/response.schema.json",
"$comment": "v2.9.8",
"$ref": "#/$defs/root",
"$defs": {
"root": {
"title": "payload body",
"description": "Packages the specified files and folders as *.zip files and returns their download addresses",
"type": "object",
"additionalProperties": false,
"required": [
"code",
"msg",
"data"
],
"properties": {
"code": {
"type": "integer",
"description": "status code"
},
"msg": {
"type": "string",
"description": "status message"
},
"data": {
"$ref": "#/$defs/data"
}
}
},
"data": {
"title": "IData",
"description": "response data",
"type": "object",
"additionalProperties": false,
"required": [
"path"
],
"properties": {
"path": {
"type": "string",
"description": "the path of *.zip exported under the workspace",
"examples": [
"temp/export/custom-file-name.zip",
"temp/export/export-2023-07-28_15-05-49.zip"
]
}
}
}
}
}