Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

md编辑器编辑预览时正常,文章发布后前台显示不正常(未解析,被截断) #15

Open
ijack365 opened this issue Aug 31, 2018 · 2 comments

Comments

@ijack365
Copy link

ijack365 commented Aug 31, 2018

两个问题:
1.md编辑器的:todolists,emoji表情,流程图等在后台编辑时进行预览没有问题,文章发布后前台显示的是却是md源码,并未正确解析显示。
image

2.md编辑器编写很长文章时,编写/预览/存储(数据存储完整)都没有问题。前台显示长文章时,文章显示不完全,被截断了。

@lincenying
Copy link
Owner

你用的服务端是
koa2: https://github.com/lincenying/mmf-blog-api-koa2-v2
express: https://github.com/lincenying/mmf-blog-api-v2
这两个吗?

md 是在服务端转码的, 没有在vue端

  1. 检查下接口返回的数据有没有被截断

@ijack365
Copy link
Author

ijack365 commented Sep 1, 2018

大致找到原因了:
1.前后端采用的md解析库不一致导致的。
前端的:todolists,emoji,流程图是pandao/editor.md里的特性。
后端的:markedjs/marked仅仅是将最基本的md语法转为html,并不能解析pandao/editor.md里的这几个特性。
所以存储html时,md应该使用vue端的pandao/editor.md来转码呀?
2.接口返回的数据没有被截断。已经查到原因是html未被转义造成的:
问题内容在:“通过<style>标签将 CSS 添加”。
md转码时,这里的<style>被当作了html标签,导致<style>后续的内容都被包含在<style></style>里而未显示。在md添加转义解决。
3. 最近在认真看你的源码,有很多问题却找不到人交流,方便提供联系方式或群号交流吗?364912432这个群已经加不进去了。

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

No branches or pull requests

2 participants