evilstreak / markdown-js

A Markdown parser for javascript
7.69k stars 863 forks source link

Support for HTML blocks (w/ tests) #98

Open dtao opened 11 years ago

dtao commented 11 years ago

This is almost the same change @marijnh submitted 2 years ago in evilstreak/markdown-js#34, but with a few differences:

vanthome commented 10 years ago

Why is this not merged yet? According to the Spec of markdown, HTML tags must be supported.

ksankaran commented 10 years ago

Any idea when this change be merged?

matthiasg commented 10 years ago

good question.. this is sadly not in accordance with markdown specs ... any specific reason why ?

hrajchert commented 10 years ago

Is this going to be merged? it would be nice to have html tags

codingisacopingstrategy commented 10 years ago

Hey it would nice to know what’s blocking here, any way we can help out? Thanks—

ashb commented 10 years ago

A few things:

  1. check it works for you and doesn't have any edge cases or odd behavior
  2. Work out what we want to do in cases like this:

    <div>This *is still* markdown in some parsers and should be parsed as such.</div>

(I'm not hugely happy with the idea of a __RAW block in HTML but eh, I'll live)

dtao commented 10 years ago

@ashb:

  1. What would you like to see? This commit passes tests, and from my usage works fine. Do you want screenshots? Perhaps some canonical sites using markdown-js that we could verify still work correctly with this change?
  2. My opinion is that Markdown embedded within raw HTML blocks should not be supported. I think this is a pretty justified position given it's what Gruber specified in the original documentation:

Note that Markdown formatting syntax is not processed within block-level HTML tags. E.g., you can’t use Markdown-style emphasis inside an HTML block.

I agree that __RAW looks pretty ugly, but given my position on point 2 above, I think the term "raw" actually makes a lot of sense as it implies no additional processing (hence no embedded Markdown).

codingisacopingstrategy commented 10 years ago

I’d also follow Gruber, especially if it is the behaviour that already works now, and is followed in many other implementations.

If someone has a need for Markdown processing in HTML tags they can always try and do a pull request after… It could be an option, or like in python-markdown an attribute you specify on the HTML.

cheers,

aleray commented 10 years ago

Very much interested in seeing this merged too!

ashb commented 7 years ago

(I'm not expecting the original author to pick this up as I've let it languish for years. Just for the record)

This patch goes someway to addressing HTML support but doesn't account for inline html elements Hi I am <em>html</em>.

Additional in #279 the case was made that HTML support should not be on by default and I'm tempted to agree.