-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Bad <br> conversions from MD to HTML to MD #974
Comments
I came across this issue too today. Doesn't even require MD -> HTML -> MD conversion. The issue is simply in HTML -> MD. Given the following html:
Showdown will produce the following markdown:`
Did some digging and realised that this is because the tagged release version of showdown 2.1.0 doesn't contain the I monkeypatched these in, and it mostly solves the problem. With the two changes mentioned above in the code the markdown output becomes:
The issue now is the leading space appearing on the 2nd and 3rd lines. A little bit more investigation and I found line 400 in converter.js in the
Modifying this line to My solution to this was to simply remove the space at the start of any line in the parse markdown that started with a single space. I don't think there would be any other occasions this would happen - it would only be following a linebreak. Adding this on line 393 of
This feels a bit of a hack, but it works. All the tests pass, and adding a testcase for the starting html and expected markdown passes too. Maybe there's a more elegant solution? Is there any way to get I can't quite work out the status of showdown - as I mentioned some of this 'fix' is already in 'develop' and 'master' branch. It doesn't seem liek there's a lot of active developemnt. Is there a new release planned at any point? We're actively using this in our app, and would love for stuff like this to work out of the box, rather than having to include workarounds in our app code (or have the overhead of managing a fork). If there's anything I can do to help / contribute to the project then I'm happy to Thanks a lot, |
Hello,
A simple conversion from a markdown with breaks to HTML to markdown doesn't work as expected. The breaks are not translated as appropriate.
(showdown 2.1.0)
Input
There are spaces
' '
aftertext1
andtext2
, see the script.Script
Output
The text was updated successfully, but these errors were encountered: