Skip to content

[EuiMarkdownEditor] Enhancement request: "Newlines -> line breaks" as a default plugin #5141

Closed

Description

@i-a-n

I notice that, since EuiMarkdownEditor is using Remark to process/render markdown, it follows Remark's default behavior and does not render single newlines as actual line breaks (<br>):

markdowneditor

I know this behavior is technically up to spec, and GitHub et al. are doing their own extra processing to make newlines into <br>s, but would you consider adding a default plugin to mimic this newline -> line break processing? There is a Remark plugin called remark-breaks which already does this, and should hopefully be simple to implement. Would this be something you'd consider, or will we need to create our own processing plugin for this?

Activity

  1. chandlerprall commented on Sep 4, 2021

    @chandlerprall
    Contributor

    Would this be something you'd consider, or will we need to create our own processing plugin for this?

    This one would be a breaking change, and a potentially significant one as a lot of markdown uses is UGC. The component is marked as beta, but if I were a consumer I'd be unhappy about this change.

    Closing this, but if anyone feels strongly otherwise feel free to re-open for discussion.

  2. cchaos commented on Sep 4, 2021

    @cchaos
    Contributor

    I disagree that consumers would be unhappy with this change. I think it is the more expected behavior than what it currently does and/or could be a setting that is something like respecteWhiteSpace. I would much rather this approach than to have to create custom plugins to allow for spacing.

  3. reopened this on Sep 4, 2021
  4. elizabetdev commented on Sep 6, 2021

    @elizabetdev
    Contributor

    I share the same opinions as @cchaos

    I disagree that consumers would be unhappy with this change

    When I opened the PR #5059 was because I missed something for spacing. So I'll rethink #5059.

  5. self-assigned this
    on Sep 6, 2021
  6. chandlerprall commented on Sep 8, 2021

    @chandlerprall
    Contributor

    I'm convinced. I think we should avoid any new prop / configuration and just go with it, and maybe allow opting out with the incoming configuration - elizabetdev@90a669a#diff-d5fec82a5af6bfbe83ee2cee3b7aad4e015f98f57996b8f8eb703a14688efbc0R74.

  7. j-m commented on Sep 30, 2021

    @j-m
    Contributor

    This is expected behaviour for markdown.
    To insert a br in markdown just use (at least) two spaces at the end of the sentence.
    You need to be careful with the implementation, this could be a breaking change, as content that already has double spaces and a new line may now have 2 brs.
    I'd like to see this as an opt-in feature as it largely depends on the use-case; for example, markdown on GitHub's issues and comments insert a br without two spaces, whereas its .md file editor (i.e. try editing a README.md) does not, i.e. a text editor that supports markdown, vs a markdown editor.
    I'd suggest making this an opt-in feature, as you're doing something differently to the defacto markdown standard.

  8. i-a-n commented on Oct 13, 2021

    @i-a-n
    ContributorAuthor

    heya all, (especially @miukimiu), I'm wondering if there's any timeline or prioritization happening on this one? asking because it's something that's preventing us from using EuiMarkdownEditor. totally fine if there's no timeline here, I'll just try writing a custom plugin until this is ready. thanks!

  9. elizabetdev commented on Oct 14, 2021

    @elizabetdev
    Contributor

    Hi @i-a-n,

    My first approach was not ideal: #5059. So I closed the issue.

    Then I did some experiments locally and talked with @chandlerprall about it. No ideal too.

    So we agreed on the following approach:

    This is something an engineer has to do. So let's see what @chandlerprall says about timeline or prioritization. But I would say if this is something that is not difficult to do, and you have time, you can open a PR instead of writing a custom plugin.

  10. removed their assignment
    on Oct 14, 2021
  11. i-a-n commented on Oct 14, 2021

    @i-a-n
    ContributorAuthor

    perfect, thanks for the update @miukimiu, I'll try to help with that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions