Open hanford opened 2 years ago
Originally I was patching the @lexical/markdown
but instead ended up creating my own UNORDERED_LIST
and ORDERED_LIST
transforms which seemed slightly easier to keep up to date.
The downside is I ended up needing to duplicate a lot of code to get this to work, copying listReplace
and listExport
with very slight modifications (notice the indentSize
argument that's been added to both functions and is passed in from the transform declarations.
https://gist.github.com/hanford/e15a0f3be981beb91602a6b1c82fa39a
Is there a better way to do this? Replacing these transforms might be common so adding better support might be helpful
Currently Lexical (0.2.9) treats
numbered lists
the same asunordered lists
and indents nesting with four spaces. However lists where the marker takes up multiple spaces (ordered lists), must be treated special differently.According to the commonmark spec:
This can be quickly repro'd over here: https://codesandbox.io/s/lexical-rich-text-example-forked-e8comj?file=/src/Editor.js, by creating an ordered list and then clicking "Generate markdown" which logs the generated markdown.
refs https://github.com/facebook/lexical/issues/2208
I'm happy to try and fix my inputs with a regex if this isn't the desired functionality!