-
Notifications
You must be signed in to change notification settings - Fork 118
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
Pass unsupported tags instead of dropping them #24
Comments
Hey Ben, I agree, it would be nice to have an option for that. I'll dig into that and let you know, alright? |
If you could point me in the right direction, would be glad to help. I get stuck on getting a tag back with its attributes as a string. Two cases to handle:
|
Coded around the problem by using Nokogiri to modify the HTML before passing to |
Will be part of the upcoming next release, thanks again for reporting! 👍 |
@benbalter: How did you achieve passing through an unknown tag? I am facing the exact problem right now. |
I made them known tags. |
@mbrgm I release 0.5.0 where |
It seems the new default behavior in 0.5.0 is to pass the tags through as HTML (rather than dropping them as it did before). Turning off |
Sure, catching config.unknown_tags = :raise # Raises the error
config.unknown_tags = :drop # Drops the these tags
config.unknown_tags = :dump # Dumps tags as html What do you think? |
I like that approach a lot. I might call it |
Alrighty! I'll open that issue again and let you know when it's done - shouldn't take too long. |
There are 4 options now: config.unknown_tags = :raise # Raises the error
config.unknown_tags = :drop # Drops the these tags
config.unknown_tags = :pass_through # Include the html
config.unknown_tags = :bypass # Ignore tags but handle their children |
Ah, ok.
Unfortunately I need a ruby gem which does not yet support ~> 2.0.0, so I'll have to stick with 0.4.7 for some time.
+1 on that, and +1 on Edit: Few seconds too late ;-). I really like the changes. Great work! |
@mbrgm I just added 1.9.3 support back in, hope this helps you. Once travis ran through I'll release 0.5.1 with those changes. Thanks to both of you for participating, it's always more fun if one gets some feedback! 👍 |
❤️ that approach. 🚲-shedding, but perhaps |
Great @xijo. Thanks for adding 1.9.3 support! This gem saves me a ton of work converting HTML documentation to an easiier maintainable markdown version! |
Isn't it? :) I chose |
👍 |
I just came to the point where I'd want to keep the unknown tag but process its children, i.e. a mixture of |
Hmm, that would be the use for a custom converter I think. You can write and register them for your special needs, I wrote an wiki page about it: https://github.com/xijo/reverse_markdown/wiki/Write-your-own-converter Please let me know if it worked out for you or if you had trouble with this approach. |
What's the logic behind dropping all unsupported tags, rather than passing them through?
HTML is valid within markdown. If I have a non-markdownable entity (e.g. a script tag) reverse_markdown should pass it through to the output (or at least give me the option to do so).
The text was updated successfully, but these errors were encountered: