Closed
Description
该问题是否已经被报告过了? Is there an existing issue for this?
- 我已经搜索了 Issues,没有发现类似问题
I have searched the existing issues
该问题是否能够在默认主题(daylight/midnight)下重现? Can the issue be reproduced with the default theme (daylight/midnight)?
- 我能够在默认主题下重现该问题
I was able to reproduce the issue with the default theme
描述问题 Describe the problem
数据库 markdown
字段与 API getBlockKramdown
, exportMdContent
返回的内容中行内元素
<
被转义为<
>
被转义为>
&
被转义为&
"
被转义为"
但是使用 API /api/block/*
增改块时若在行内元素中使用这些转义符, 增改的块将丢失原字符
比如插入/更新内容为 **11<22>33&44"55**
, 插入/更新后的块只显示 **1122334455**
这样会导致 导出/查询 → 处理 → 导入
自动化流程无法正常进行
期待的结果 Expected result
输出时与输入时对这些符号处理原则保持一致
解决方案 1
输出时(数据库 markdown
字段与 API getBlockKramdown
返回的内容)行内元素使用 \
转义, 比如使用 \<
转义 <
解决方案 2
输入时(使用 API /api/block/*
增改块)行内元素同时支持解析 <
等方式转义的字符
截屏或者录屏演示 Screenshot or screen recording presentation
No response
版本环境 Version environment
- Version: 2.5.1
- Operating System:
- Browser (if used):
日志文件 Log file
无有效信息输出
更多信息 More information
No response
Metadata
Metadata
Assignees
Type
Projects
Relationships
Development
No branches or pull requests
Activity
[-]数据库 `markdown` 字段, API `getBlockKramdown & exportMdContent` 与 API `/api/block/*` 中对行内元素转义符号处理不一致[/-][+]数据库 `markdown` 字段和 API 对行内元素转义符号处理不一致[/+]88250 commentedon Nov 25, 2022
我这里测试没有重现问题:
使用 insertBlock 插入:
但是使用 HTML 实体插入确实有问题:
我们先改进这个问题。
Zuoqiu-Yingyi commentedon Nov 25, 2022
出问题的是行内元素内部的 HTML 转义字符, 例如这个请求体
88250 commentedon Nov 25, 2022
@Zuoqiu-Yingyi 明白了,谢谢。
[-]数据库 `markdown` 字段和 API 对行内元素转义符号处理不一致[/-][+]API 行级元素嵌套 HTML 实体时丢失实体内容[/+][-]API 行级元素嵌套 HTML 实体时丢失实体内容[/-][+]使用 API 插入行级元素嵌套 HTML 实体时丢失实体内容[/+]🎨 Protyle 将 HTML 实体渲染为转义文本 siyuan-note/siyuan#6714
🐛 Protyle 使用 API 插入行级元素嵌套 HTML 实体时丢失实体内容 Fix siyuan-note/siyuan#6714