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

挂件块数据导出属性 data-export-md #3834

Closed
leolee9086 opened this issue Jan 15, 2022 · 13 comments
Closed

挂件块数据导出属性 data-export-md #3834

leolee9086 opened this issue Jan 15, 2022 · 13 comments
Assignees
Milestone

Comments

@leolee9086
Copy link

在什么情况下你需要该特性? In what scenarios do you need this function?

目前的挂件块在导出markdown等格式之后不太可用,提供一个可选的"替代内容"属性可能可以改善挂件在导出时的可用性

例如

类似"文档内目录"的挂件块可以指定在导出时渲染为无序列表.
类似excalidraw等绘图挂件导出时可以替换为指定的元素如嵌入图片等.

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

指定一个固定的属性,例如custom-markdown,在导出为markdown等文件格式时,将挂件内容以这一属性的内容进行替换渲染

其他信息 Other information

类似于html中image等标签可选的占位属性,在不便于导出时替换内容块的原始内容
不仅可以用于挂件块这一场合,也可以手动为其他不便于导出的内容指定占位字符,;例如加载失败的图片等之类

更进一步的

目前的挂件块无法链接其他块,可能可以指定一个refs属性,形式为块id数组,用于链接其他块,在索引时视为块链接
这样可能也适用于嵌入块

@88250
Copy link
Member

88250 commented Jan 15, 2022

这个数据渲染的接口是由挂件来实现吗?比如内核执行导出时,调用挂件块的 HTTP 接口获得导出数据,然后用导出数据填充到导出的文件。

后面提到的 refs 属性不会添加,特定应用领域需要挂件自己维护。

@leolee9086
Copy link
Author

我觉得直接写到挂件的块属性就可以了,调用的时候直接读属性,类似现在的data-assets被视为附件引用

@leolee9086
Copy link
Author

leolee9086 commented Jan 15, 2022

比如说某个挂件块的custom-markdown属性里是

  • foo
    • bar

那么在导出的时候直接把这里的字符串当成它的markdown内容填充就好了

@88250
Copy link
Member

88250 commented Jan 15, 2022

明白了,这个方案应该能工作,我们再考虑看看。

@leolee9086
Copy link
Author

主要是好多人提文档内的目录 我感觉这样替换一下应该就可以

@88250
Copy link
Member

88250 commented Jan 15, 2022

文档内的目录是 [ToC] 还是?

@leolee9086
Copy link
Author

TOC

@88250
Copy link
Member

88250 commented Jan 15, 2022

嗯,这个场景等这个提议实现以后可以试试看。

@88250 88250 added this to the ~1.8.0 milestone Jan 16, 2022
@88250 88250 self-assigned this Jan 16, 2022
@88250 88250 changed the title 挂件块导出替代内容属性 挂件块数据导出属性 Jan 16, 2022
@88250 88250 changed the title 挂件块数据导出属性 挂件块数据导出属性 data-export Jan 16, 2022
@88250 88250 changed the title 挂件块数据导出属性 data-export 挂件块数据导出属性 data-export-md Jan 16, 2022
@88250
Copy link
Member

88250 commented Jan 16, 2022

属性 data-export-md 专门用于导出 Markdown 时使用,导出 HTML 也用这个属性,将 md 渲染为 html。

@88250 88250 closed this as completed Jan 28, 2022
@88250 88250 modified the milestones: 1.8.0, 1.7.10 Jan 30, 2022
@Zuoqiu-Yingyi
Copy link
Contributor

该属性的属性值是否需要进行一些转义或编码处理呀❓

@88250
Copy link
Member

88250 commented Jan 30, 2022

@Zuoqiu-Yingyi 用 API 设置,应该会处理好的。

@Zuoqiu-Yingyi
Copy link
Contributor

@88250 导出预览里面的挂件如果设置了 data-export-md 属性,是否应该显示其内容而非挂件 iframe 呢❓

@88250
Copy link
Member

88250 commented May 21, 2022

@88250 导出预览里面的挂件如果设置了 data-export-md 属性,是否应该显示其内容而非挂件 iframe 呢❓

麻烦开个 issue

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

No branches or pull requests

3 participants