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

支持XML解析为组件 #164

Closed
HerbertHe opened this issue Feb 24, 2022 · 3 comments
Closed

支持XML解析为组件 #164

HerbertHe opened this issue Feb 24, 2022 · 3 comments

Comments

@HerbertHe
Copy link
Contributor

你在什么场景下需要该功能? In what scenarios do you need this function?

越来越多的在线文档工具支持在Markdown里面插入 Vue/React组件,例如:slidev、vuepress、vitepress、React的新文档等。

下面举个🌰:

# 测试文本

<TestComponent />

为了实现渲染,Vue系的做法是将Markdown文法转化为Vue组件,插入的组件根据某些自定义规则,导入组件路径(自定义的规则)进行前端渲染。这样在前端展示里就有了更多的玩法。

描述最优的解决方案 Describe the optimal solution

自定义组件是有规则的,所以只要与html区分开来即可。

自定义组件跟HTML标签唯一的差别就是首字母大写,可以是自闭合标签、也可以拥有子元素。

在Lute golang渲染的场景下,我建议屏蔽掉组件渲染的功能。因为其使用场景一般是在前端运行时,所以renderer无需进行处理(golang端屏蔽渲染;前端输出,通过二次渲染),前端使用需要自己写renderer和feature(已将Vditor渲染逻辑编辑成文发布链滴)。

这样 Vditor 通过前端的处理,就拥有了与目前流行的前端框架相同的功能,这对于基于 Vditor 的文档生成有非常棒的实际意义。

描述候选解决方案 Describe the candidate solution

其他信息 Other information

@88250
Copy link
Owner

88250 commented Feb 25, 2022

这个估计得先解决 #75 才方便扩展。

@HerbertHe
Copy link
Contributor Author

如果要实现自定义的解析器,得动手自动机了吧。。。实用性来说,现在主流的规则都是只解析到符合GFM规范就行了emmm😂

@88250
Copy link
Owner

88250 commented Feb 25, 2022

先关闭了,这个还得考虑。

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

No branches or pull requests

2 participants