xijo / reverse_markdown

Ruby gem to convert html into markdown
Do What The F*ck You Want To Public License
628 stars 118 forks source link

tag_border option is being ignored. #65

Closed AlexanderPruss closed 8 years ago

AlexanderPruss commented 8 years ago

The tag_border option can theoretically be used to specify whether tags have a whitespace border or not:

#default:
ReverseMarkdown.convert("markdownFoo")
#no whitespace:
ReverseMarkdown.convert("markdownFoo", tag_border:'')

This option doesn't work at the moment, because:

The bug can be fixed straightforwardly by moving the cleaner.tidy call into the config block. I'll add a PR in a bit demonstrating the fix.


Justification: Using ReverseMarkdown to parse tricky mixed tags of this form

<a href=\"http://Google.de\"><em><b>Google</b></em><b>.de</b></a>

results in the following output

[_ **Google** _ **.de**](http://Google.de)

The underscore tags aren't parsed correctly by markdown (or by redcarpet) because they're separated from the bold tag by the whitespaces added by the cleaner.

AlexanderPruss commented 8 years ago

I forked your project and added a fix. Could you see if we could merge it into the master branch?

https://github.com/AlexanderPruss/reverse_markdown

xijo commented 8 years ago

@AlexanderPruss hi Alexander, thanks for reporting the issue and your work on it. Please submit a PR, so that the specs can run through. Everything looks fine and valid from my point of view, so it should be possible to merge it ASAP.

AlexanderPruss commented 8 years ago

That's great to hear! The PR Is up.