Export MarkdownParser and MarkdownSerialiser #25
Replies: 6 comments
-
I can create a PR if you'd like as well |
Beta Was this translation helpful? Give feedback.
-
editor.storage.markdown.parser.parse(content)
editor.storage.markdown.serializer.serialize(doc) These are accessible so you can call it in a custom command. However it's not documented so it may change in a future version. |
Beta Was this translation helpful? Give feedback.
-
@aguingand I would like to use this extension's code and not have it change the behaviour of insertContent and inserContentAt. Thats the reason i think the exports would be valuable. Unless there other ways to accomplish this? |
Beta Was this translation helpful? Give feedback.
-
I don't plan to export Parser & Serializer before v1.0. If you have a feature to add that can be passed as an option, feel free to make a PR. I will convert this to a discussion for now. |
Beta Was this translation helpful? Give feedback.
-
Your issue can't be solved be overriding the command ? import { extensions } from '@tiptap/core';
import { Markdown } from 'tiptap-markdown';
Markdown.extend({
addCommands() {
const commands = extensions.Commands.config.addCommands();
return {
...this.parent(),
insertContentAt: (range, content, options) => (props) => {
const parsed = props.editor.storage.markdown.parser.parse(content, { inline: true });
// do something here
return commands.insertContentAt(
range,
parsed,
options
)(props);
},
}
},
}); |
Beta Was this translation helpful? Give feedback.
-
@aguingand is there a way to extend Markdown Extension to write a custom serializer... we have a custom Node type in TipTap and use |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
I'm trying to get streamed markdown working with tiptap and this extension.
Describe the solution you'd like
Could markdown parser be exported? I'd like to use this however, i don't want to modify my current insertContent and insertContentAt. It would be great to call it directly, manipulate the result and then insert it into tip tap
Describe alternatives you've considered
A lot of hacking
cc: @aguingand
Beta Was this translation helpful? Give feedback.
All reactions