halo
halo copied to clipboard
Support conversion between default editor and Markdown
Your current Halo version
main
Describe this feature
We can add this feature to the core code of the default editor,plugins can implement their own parse function in addOptions()
.#5157
Perhaps it could look something like this:
addOptions() {
return {
...this.parent?.(),
serializer(markdowSerializer: MarkdownSerializer ) {
// Node
markdowSerializer.nodes['custome-node'] = (state, node) => {
state.write(node.attrs.content)
// Mark
markdowSerializer.mark['custome-mark'] = (state, node) => {
state.write(node.attrs.content)
}
},
};
}
- https://github.com/ProseMirror/prosemirror-markdown
Additional information
/kind improvement
+1 for this feature even though it's not perfect.
This approach would be dependent on the editor, and I am unable to envision a use case for it. If the goal is simply to export HTML to Markdown, there are already libraries available for that purpose, such as turndown. For tags that are not native HTML, we can export them as they are.
For tags that are not native HTML, we can export them as they are.
Couldn't agree more, but I think there's an opportunity for us to do even better.
We can give some plugins a chance , that if they can be converted to Markdown.
For example, Katex can be represented as $x_y$
in Markdown.