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

Rendering of the <style> tag #265

Closed
fliiiix opened this issue Nov 12, 2022 · 2 comments
Closed

Rendering of the <style> tag #265

fliiiix opened this issue Nov 12, 2022 · 2 comments
Assignees
Labels

Comments

@fliiiix
Copy link

fliiiix commented Nov 12, 2022

[❤ l33tname@fedora:~] markdown --version
markdown: discount 2.2.7c
[❤ l33tname@fedora:~] cat foo.md 
Hello *github*
<style type='text/css' media='screen'>
p{margin:5px}
</style>

<h2>foo</h2>
[❤ l33tname@fedora:~] markdown foo.md 
<p>Hello <em>github</em></p>





<h2>foo</h2>

Is that a bug or are we holding it wrong? For some reason the style tag is filtered.
I also checked in dingus which does the right thing.
image

This issue was raise in rdiscount (davidfstr/rdiscount#149) but unless we are holding it wrong i assume that is a bug here.

@Orc
Copy link
Owner

Orc commented Nov 12, 2022

That's actually as designed. But you can disable that behavior with -fnostyle (the flag MKD_NOSTYLE if you're using discount as a library)

@Orc Orc added the question label Nov 12, 2022
@Orc Orc self-assigned this Nov 12, 2022
@fliiiix
Copy link
Author

fliiiix commented Nov 12, 2022

Thanks for your fast reply! 🎉 ✨

bug

Ok i guess I found what the bug is because we have a test in rdiscount which worked without setting the MKD_NOSTYLE flag.

[✖ l33tname@fedora:~] markdown foo.md 
<p>Hello <em>github</em><style type='text/css' media='screen'>p{margin:5px}</style></p>
[❤ l33tname@fedora:~] cat foo.md 
Hello *github*<style type='text/css' media='screen'>p{margin:5px}</style>

If the style text is inline it does not get filtered out, which probably should happen since that produces valid html with a style tag.

Nitpick

If you look into this I also would have a nitpick:

[❤ l33tname@fedora:~] cat foo.md 
Hello
<style>
p { margin: 5px; }
</style>
[❤ l33tname@fedora:~] markdown -fnostyle foo.md
<p>Hello</p>

<style>
p { margin: 5px; }
</style>

[❤ l33tname@fedora:~] 

See the extra \n before and after the <style> block.

@Orc Orc closed this as completed Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants