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

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

Closed
i-a-n opened this issue Sep 3, 2021 · 8 comments · Fixed by #5272
Closed

Comments

@i-a-n
Copy link
Contributor

i-a-n commented Sep 3, 2021

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?

@chandlerprall
Copy link
Contributor

chandlerprall commented Sep 4, 2021

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.

@cchaos
Copy link
Contributor

cchaos commented Sep 4, 2021

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.

@cchaos cchaos reopened this Sep 4, 2021
@miukimiu
Copy link
Contributor

miukimiu commented Sep 6, 2021

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.

@chandlerprall
Copy link
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 - miukimiu@90a669a#diff-d5fec82a5af6bfbe83ee2cee3b7aad4e015f98f57996b8f8eb703a14688efbc0R74.

@j-m
Copy link
Contributor

j-m commented Sep 30, 2021

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.

@i-a-n
Copy link
Contributor Author

i-a-n commented Oct 13, 2021

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!

@miukimiu
Copy link
Contributor

miukimiu commented Oct 14, 2021

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.

@miukimiu miukimiu removed their assignment Oct 14, 2021
@i-a-n
Copy link
Contributor Author

i-a-n commented Oct 14, 2021

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants