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

Interpret newlines as line breaks when converting Markdown to HTML #74

Closed
ulyssa opened this issue Mar 28, 2023 · 1 comment
Closed
Assignees
Milestone

Comments

@ulyssa
Copy link
Owner

ulyssa commented Mar 28, 2023

When messages are typed in Element, it has a special case for interpreting newlines typed in the bar as <br/> tags instead of as a continuation of the current paragraph, which is the typical Markdown behaviour. This is more friendly towards the usual expectations in a chat client, where people usually type their paragraphs on one continuous line that wraps, instead of paragraphs that are split across multiple lines so that each one fits within a column limit.

iamb is currently using the markdown feature of the ruma crate to take care of converting Markdown to a formatted message, which uses the pulldown_cmark crate. The crate supports several parser options that can be used to change the default behaviour. None of them currently support this behaviour, but it might be possible to either add a new option to the crate, or to massage the input before it's handed over.

@ulyssa
Copy link
Owner Author

ulyssa commented Mar 28, 2023

The comrak crate has a hardbreaks option that you can use when rendering HTML.

@ulyssa ulyssa added this to the v0.0.8 milestone Mar 29, 2023
@ulyssa ulyssa changed the title Interpret a newline as a line break when converting Markdown to HTML Interpret newlines as line breaks when converting Markdown to HTML Apr 6, 2023
@ulyssa ulyssa closed this as completed Apr 7, 2023
@ulyssa ulyssa self-assigned this Apr 7, 2023
@ulyssa ulyssa mentioned this issue Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant