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

Fix soft linebreaks in editable content #2147

Closed

Conversation

chrispymm
Copy link
Contributor

Issue:
When initialised, <br> tags in the content html aren't being properly converted into \n for a markdown soft linebreak.

After much investigation, the issue here is showdown 🙄 The latest release version does not include a subParser a that handles <br> elements. Yes, that's right, a very popular markdown conversion library cannot handle <br> tags.

The code to handle br tags does exist within the showdown repo, it is just in the develop and master branches, (albeit still with a slight issue) I've posted a long comment to the showdown issue related to this and we'll see if I get a response, it doesn't seem like there's too much active development.

Solution:
Anyway, the solution for us right now is a regex to find and replace the rogue <br> tags with the correct markdown syntax.

Have also added a test to check for soft linebreak handling too.

@chrispymm chrispymm force-pushed the testable-fix-soft-linebreaks-in-editable-content branch from b7badf6 to bbac905 Compare April 12, 2023 15:38
@chrispymm chrispymm closed this Apr 13, 2023
@chrispymm chrispymm deleted the testable-fix-soft-linebreaks-in-editable-content branch April 13, 2023 09:56
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

Successfully merging this pull request may close these issues.

None yet

1 participant