-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
leave HTML code as is #855
Comments
First of all, to have a better chance of this working, you should put an empty line between the But: This library does implement this for
|
that depends entirely on how robust the parser's written to be. That said I ended up writing a chunker in the interrim that just takes the input, chops it up into parts that should have markdown applied and parts that don't, and only then runs the parts that do through the conversion library. |
A lot of specs (actually almost all) do have "raw" html tags like divs: http://spec.commonmark.org/0.27/#example-119 and GFM: this is in a div
That said I believe it is correct that in a code block ``` it should return the html encoded version of this as http://spec.commonmark.org/0.27/#example-88 describes |
@matt- Those are just I've looked into this some more. First of all, I'm still not sure if this library is supposed to be implementing commonmark. If it does not, then not converting markup within divs is standard behavior as far as I know, and the case would be moot. I got some interesting results when I tested this again. Inserting OP's example literally, I could not reproduce the problem: But when I remove the trailing More tests:
And
This behavior looks wrong to me. Am I missing anything obvious? |
The original code was for terseness, using something more spaced out like
generates:
with the content of the div somehow treated as "I should skip over this" by the library. The real trick isn't whether it should always do one thing or another, this should be something one can toggle, where calling something like:
makes it copy HTML tags verbatim without doing anything to them, and without recognizing content between some In fact, and even better result would be to have an option like
So that the content itself can indicate what the parser should do:
|
Right now, marked will convert this:
into this:
that is to say: it doesn't convert it at all. It treats the
<div>
as somehow being meaningful syntax rather than "just text without any markdown syntax rules that match it" and so it refuses to convert the content of that div, despite the fact that markdown has no divs: it's just inert text that needs to be preserved.The text was updated successfully, but these errors were encountered: