Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve kernel API /api/block/getBlockKramdown #13183

Closed
Achuan-2 opened this issue Nov 18, 2024 · 2 comments
Closed

Improve kernel API /api/block/getBlockKramdown #13183

Achuan-2 opened this issue Nov 18, 2024 · 2 comments
Assignees
Milestone

Comments

@Achuan-2
Copy link
Member

Achuan-2 commented Nov 18, 2024

/api/block/getBlockKramdown 支持导出 span 元素样式

In what scenarios do you need this feature?

通过块引实现脚注,想通过导出kramdown,将块引锚文本变为脚注编号

PixPin_2024-11-18_19-43-35

发现,目前/api/block/getBlockKramdown获得的data和导出模板得到的data并不一致
/api/block/getBlockKramdown
PixPin_2024-11-18_19-39-06

'事<sup>((20241118190659-8v4a45p "注"))</sup>{: style="--memo: 1"}实上<sup>((20241118190702-rywdn7p "注"))</sup>{: style="--memo: 1"}\n{: id="20241118180021-1hva1qs" updated="20241118190702"}'

导出模板
PixPin_2024-11-18_19-39-28

事<span data-type="block-ref sup" data-subtype="s" data-id="20241118190659-8v4a45p">注</span>{: style="--memo: 1"}实上<span data-type="block-ref sup" data-subtype="s" data-id="20241118190702-rywdn7p">注</span>{: style="--memo: 1"}
{: id="20241118180021-1hva1qs"}

如果/api/block/getBlockKramdown得到的内容,使用/api/block/updateBlock来更新块,块引样式就会消失
PixPin_2024-11-18_19-41-26

let data = {
  "dataType": "markdown",
  "data": res.data.kramdown,
  "id": "20241118180021-1hva1qs"
}

await fetchSyncPost('/api/block/updateBlock', data);

而使用模板导出的kramdown则不会

Describe the optimal solution

/api/block/getBlockKramdown 支持导出span元素样式

Describe the candidate solution

可以直接获取文档的DOM

Other information

No response

@Achuan-2
Copy link
Member Author

发现如果是静态锚文本的块引粘贴就有问题,动态锚文本的块引就没问题

静态锚文本<sup>((20241119112943-2u0qmkw "20241119 11:29:43"))</sup>
动态锚文本<sup>((20241119112943-2u0qmkw '20241119 11:29:43'))</sup>

PixPin_2024-11-19_11-56-00

@88250 88250 self-assigned this Nov 20, 2024
@88250 88250 added this to the 3.1.14 milestone Nov 20, 2024
@88250 88250 changed the title /api/block/getBlockKramdown 支持导出span元素样式 Improve kernel API /api/block/getBlockKramdown Nov 20, 2024
@88250
Copy link
Member

88250 commented Nov 20, 2024

增加一个参数 mode

  • md:Markdown 标记符模式,使用标记符导出(默认)
  • textmark:文本标记模式,使用 span 标签导出

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants