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

[Bug report]getHtml()->makeMarkdown()的问题 #414

Closed
alexwenbj opened this issue Mar 21, 2023 · 5 comments
Closed

[Bug report]getHtml()->makeMarkdown()的问题 #414

alexwenbj opened this issue Mar 21, 2023 · 5 comments
Labels
🐞bug Something isn't working

Comments

@alexwenbj
Copy link

Describe the bug

To Reproduce
Steps to reproduce the behavior:

  1. md内容如下:
test
\`\`\`python
print("helloworld")
\`\`\`
  1. 使用cherry.getHtml()将渲染的Html代码保存(到数据库)
  2. 将保存的HTML代码取出来,使用cherry.setMarkdown(cherry.engine.makeMarkdown(htmlStr))重新设置回markdown中

Expected behavior
应该重新得到

test
\`\`\`python
print("helloworld")
\`\`\`

但实际得到的是:

test

      [ ]

       \`print("helloworld")\`

Screenshots

screenshot

Environment (please complete the following information):

  • OS: [macOS]
  • Browser [Chrome]
  • Version [版本 110.0.5481.77(正式版本) (arm64)]
@alexwenbj
Copy link
Author

`前的反斜杠是开issue时自己加的。

@sunsonliu
Copy link
Collaborator

收到,的确把代码块转成markdown的逻辑有问题,我们修复下

@sunsonliu sunsonliu added the 🐞bug Something isn't working label Mar 21, 2023
@sunsonliu
Copy link
Collaborator

不过不建议只保存html内容哈,建议DB里同时存markdown和html两个内容:

  • markdown内容用来做编辑的回显、甚至是查看页的回显(用cherry的previewOnly模式);
  • html内容用来做导出、发邮件之类的功能

如果还有搜索场景,可以在DB里存一个纯文本内容(cherry.previewer.getDom().textContent

@alexwenbj
Copy link
Author

不过不建议只保存html内容哈,建议DB里同时存markdown和html两个内容:

  • markdown内容用来做编辑的回显、甚至是查看页的回显(用cherry的previewOnly模式);
  • html内容用来做导出、发邮件之类的功能

如果还有搜索场景,可以在DB里存一个纯文本内容(cherry.previewer.getDom().textContent

嗯,是保存了,只是我有旧数据只有HTML格式需要用到。
谢谢!

@sunsonliu
Copy link
Collaborator

已提交到dev分支

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants