Skip to content

Feature/Bug: multiline headings & markdown #6661

Open
@benclarkmck

Description

@benclarkmck

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions