wooorm / markdown-rs

CommonMark compliant markdown parser in Rust with ASTs and extensions
https://docs.rs/markdown/1.0.0-alpha.21/markdown/
MIT License
906 stars 50 forks source link

Markdown in HTML tags don't work #78

Closed soupslurpr closed 1 year ago

soupslurpr commented 1 year ago

Hello, thanks for this cool crate. I noticed that markdown in html tags do not work unless there is a character or more of text before the opening tag for each html tag. I also noticed it is like this in GitHub. Is this intended and could there be a way to make it work?

any text <p style="text-align: center;">
    **hello**
<p>

^ works as expected, centering and bolding "hello" with "any text" above it

any text 
<p style="text-align: center;">
    **hello**
<p>

^ Centering "hello" works, but bolding does not and the ** are visible.

ChristianMurphy commented 1 year ago

Welcome @soupslurpr! 👋 markdown-rs builds on the CommonMark (https://commonmark.org/) and GitHub Flavored Markdown (GFM, https://github.github.com/gfm/) specifications. The behavior you show, is as-described in the standard and is expected.

The way to make it work would be to customize markdown-rs using plugins https://github.com/wooorm/markdown-rs/issues/32 The design for plugins is still being ironed out, contributions towards moving plugins forward are welcome!

Closing this as the behavior described is expected, and plugin work is tracked in https://github.com/wooorm/markdown-rs/issues/32

soupslurpr commented 1 year ago

Oh alright, that makes sense. Thanks for the quick response!