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

Markdown hyperlink parsing exception when using API /api/block/* to upsert block #7846

Closed
3 tasks done
Zuoqiu-Yingyi opened this issue Mar 31, 2023 · 2 comments
Closed
3 tasks done
Assignees
Labels
Milestone

Comments

@Zuoqiu-Yingyi
Copy link
Contributor

Zuoqiu-Yingyi commented Mar 31, 2023

使用 API /api/block/* 更新/插入的 markdown 文本解析异常

Is there an existing issue for this?

  • I have searched the existing issues

Can the issue be reproduced with the default theme (daylight/midnight)?

  • I was able to reproduce the issue with the default theme

Could the issue be due to extensions?

  • I've ruled out the possibility that the extension is causing the problem.

Describe the problem

API /api/block/updateBlock 的请求体如下所示时
When the request body of API /api/block/updateBlock is shown below

{
  "dataType": "markdown",
  "data": "**[456](123 \"789\")**",
  "id": "20211230161520-querkps"
}

对应的块渲染正常, 但是数据库 markdown 字段, 导出内容, API /api/block/getBlockKramdown 返回内容如下所示
The corresponding block renders normally, but database field markdown, export content, API /api/block/getBlockKramdown return content as shown below

[456](123 "789")****

Expected result

数据库 markdown 字段, 导出内容, API /api/block/getBlockKramdown 返回内容如下所示
Database field markdown, export content, API /api/block/getBlockKramdown return content as shown below

**[456](123 "789")**

Screenshot or screen recording presentation

粗体 **[foo](bar)**, 斜体 *[foo](bar)*, 删除线 ~~[foo](bar)~~, 高亮 ==[foo](bar)==, 上标 ^[foo](bar)^, 下标 ~[foo](bar)~ 存在同样的问题
Bold **[foo](bar)**, Italic *[foo](bar)*, Strikethrough ~~[foo](bar)~~, Mark ==[foo](bar)==, Superscript ^[foo](bar)^, Subscript ~[foo](bar)~ have the same problem.

Version environment

- Version: 2.8.3-dev1
- Operating System: 
- Browser (if used):

Log file

无有效信息输出
No valid information output

More information

No response

@88250 88250 changed the title Markdown text parsing exception when using API /api/block/* to update/inserte block | 使用 API /api/block/* 更新/插入的 markdown 文本解析异常 Markdown text parsing exception when using API /api/block/* to update/inserte block Apr 1, 2023
@88250 88250 changed the title Markdown text parsing exception when using API /api/block/* to update/inserte block Markdown text parsing exception when using API /api/block/* to upsert block Apr 1, 2023
@88250 88250 changed the title Markdown text parsing exception when using API /api/block/* to upsert block Markdown hyperlink parsing exception when using API /api/block/* to upsert block Apr 1, 2023
@88250 88250 self-assigned this Apr 1, 2023
@88250 88250 added the Bug label Apr 1, 2023
@88250 88250 added this to the 2.8.3 milestone Apr 1, 2023
@88250 88250 changed the title Markdown hyperlink parsing exception when using API /api/block/* to upsert block Markdown hyperlink parsing exception when using API /api/block/* to upsert block Apr 1, 2023
88250 added a commit to 88250/lute that referenced this issue Apr 1, 2023
88250 added a commit that referenced this issue Apr 1, 2023
@88250 88250 closed this as completed Apr 1, 2023
88250 added a commit that referenced this issue Apr 4, 2023
@Zuoqiu-Yingyi
Copy link
Contributor Author

Zuoqiu-Yingyi commented May 6, 2023

@88250 v2.8.6 版本中还存在一些问题, 请求体如下所示时

{
  "dataType": "markdown",
  "data": "[`456`](123 \"789\")",
  "id": "20211230161520-querkps"
}

导出内容如下所示

[456](123 "789")``​

由此可以看出, 样式嵌套的超链接元素的导出方案应该将标志符设置在超链接锚文本的内部, 锚文本内的标志符使用 \ 转义, 如下所示

粗体 [**\*foo\*foo\***](bar), 斜体 [*\*foo\*foo\**](bar), 删除线 [~~\~foo\~foo\~~~](bar), 高亮 [==\=foo\=foo\===](bar), 上标 [^\^foo\^foo\^^](bar), 下标 [~\~foo\~foo\~~](bar), 行内代码 [`foo`](bar)

上述内容渲染结果: 粗体 *foo*foo*, 斜体 *foo*foo*, 删除线 ~foo~foo~, 行内代码 foo

@88250
Copy link
Member

88250 commented Dec 28, 2023

#9998 中会修改超链接和其他标记符的嵌套处理逻辑,将标记符移到 a 外面,例如: [**\*foo\*foo\***](bar) 会变为 **[\*foo\*foo\*](bar)**

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

No branches or pull requests

2 participants