-
Notifications
You must be signed in to change notification settings - Fork 11
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
Remove markdown from publikator #963
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might not have fully understood everything, feel free to ignore my comments if they don't make sense :)
), | ||
), | ||
content: JSON.parse( | ||
JSON.stringify(this.editor.serializer.serialize(editorState)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, why are we still stringify-parsing here? Doesn't serialize give us an mdast already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is just to make a deep copy. we are stringify-parsing to JSON, not markdown. but i understand that it offends you and we should find a more transparent solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But do we even need to make a copy here? It's just used as an argument for the mutation …
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only reason that I can think of why this could be necessary is if serialize() doesn't return a plain JSON object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is dangerous to ask oneself this kind of questions, Jeremy. (Aka: not sure why it's here, perhaps it's just a remnant from the markdown stringify-parsing – I'll investigate.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it was because stringifying to markdown was not playing nice with slate, so we needed to execute that operation on a copy of the editor state... so you are probably right, we don't need it. Will try.
Goal
get rid of mdast stringify (mdast->markdown) in publikator.
parsing markdown to mdast is less problematic. We still use markdown strings for templating and parse them to mdast for concision’s sake. this is not a bug-producing process and can be removed ad hoc.
Done
bonus
Out of Scope
TODO: