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

Feature/Bug: multiline headings & markdown #6661

Open
benclarkmck opened this issue Sep 24, 2024 · 0 comments
Open

Feature/Bug: multiline headings & markdown #6661

benclarkmck opened this issue Sep 24, 2024 · 0 comments
Labels
enhancement Improvement over existing feature

Comments

@benclarkmck
Copy link

Description

When pressing shift+enter while in heading mode, a new line is created and heading is still selected, however when you go to markdown view the generated markdown has the second line without a heading and this will then convert back to normal text when viewing the rendered dom view

Screen.Recording.2024-09-24.at.09.41.25.mov

I have 2 alternate solutions:

Option 1

Code: https://github.com/facebook/lexical/compare/main...benclarkmck:lexical:multiline-heading-option-1?expand=1

Convert this to # Line 1\n# Line 2 leaving the export as-is. This will only change the behaviour when going from dom to markdown and create no change in behaviour if lexical is used to render this markdown - it will be imported to two heading tags currently but then going back to markdown this will then export back to having a paragraph break \n\n between the headings

Screen.Recording.2024-09-24.at.09.43.30.mov

Option 2

Code: https://github.com/facebook/lexical/compare/main...benclarkmck:lexical:multiline-heading-option-2?expand=1

Convert this as in option 1 to #Line 1\n#Line 2 but keep the line break <br> within the 1 heading tag when importing. This keeps consistency between the markdown and the dom view, but is a change in behaviour if lexical is used to render any markdown with headings separated by a single line break

Screen.Recording.2024-09-24.at.09.42.31.mov

Third option (not implemented)

Another option is to not support line breaks in headings and instead go straight back to normal text, or create a new heading tag in the dom rather than line break when shift+enter, INSERT_LINE_BREAK_COMMAND command, is used while in heading mode

Impact

The current bug caused some confusion when user created shift+enter while typing a heading, so any solution would fix it.

@benclarkmck benclarkmck added the enhancement Improvement over existing feature label Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement over existing feature
Projects
None yet
Development

No branches or pull requests

1 participant