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

fix: 修复钉钉Markdown消息内不支持html代码显示的bug,对html标签进行转义 #213

Merged
merged 2 commits into from
Apr 16, 2023

Conversation

ffinly
Copy link
Contributor

@ffinly ffinly commented Apr 15, 2023

在提出此拉取请求时,我确认了以下几点(请复选框):

  • 我已阅读并理解贡献者指南
  • 我已检查没有与此请求重复的拉取请求。
  • 我已经考虑过,并确认这份呈件对其他人很有价值。
  • 我接受此提交可能不会被使用,并根据维护人员的意愿关闭拉取请求。

钉钉官方Markdown消息是不支持代码块语法的,官方文档如下:
https://open.dingtalk.com/document/orgapp/message-types-and-data-format#title-afc-2nh-5kk

此问题的根本原因是钉钉pc端在Markdown消息内会将html代码进行渲染(哪怕html代码是在代码块内也会进行渲染,从而导致无法正常显示相关代码),而手机端无法显示(显示空白)含有html代码的Markdown消息,本质上是钉钉的bug。
代码块缩进问题暂无法解决,因不管是四个空格,还是Tab,在钉钉上均会顶格显示,建议复制代码后用IDE进行代码格式化,针对缩进严格的语言,例如Python,不确定的建议手机端查看下代码块的缩进。
经验证,经过转义后,html代码显示问题已修复(无论是代码块内,还是代码块外均无显示问题),如下图所示:

image

image

@eryajf eryajf merged commit 5cc64dc into eryajf:main Apr 16, 2023
@ffinly ffinly deleted the fix-markdown-html branch June 15, 2023 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants