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

HTML following between two comments don't get recognized as HTML #1032

Closed
qzhou1607-zz opened this issue Jan 22, 2018 · 3 comments · Fixed by #1135
Closed

HTML following between two comments don't get recognized as HTML #1032

qzhou1607-zz opened this issue Jan 22, 2018 · 3 comments · Fixed by #1135
Labels
category: mixed content L2 - annoying Similar to L1 - broken but there is a known workaround available for the issue

Comments

@qzhou1607-zz
Copy link

qzhou1607-zz commented Jan 22, 2018

<!-- This is a comment -->
<details>
<summary>
    This is the summary.
</summary>
Hello!

hello!

hello!
</details>
<!-- This is a comment -->

Expectation

<!-- This is a comment -->
<details>
<summary>
    This is the summary.
</summary>
Hello!

hello!

hello!
</details>
<!-- This is a comment -->

Result

<!-- This is a comment -->
<p><details></p>
<p><summary>
    This is the summary.
</summary>
Hello!</p>
<p>hello!</p>
<p>hello!
</details>
<!-- This is a comment --></p>

What was attempted

As shown above, HTML code between two comments are identified as paragraphs instead of html. Inserting blank lines between the comments and the HTML code in markdown temporarily solved the rendering issue. But the html regex in marked.js needs to be modified to recognize HTML both before and after a comment.

Alternatively, it could just mention in the documentation that blank lines are required between the comments and the HTML code.

https://github.com/chjj/marked/blob/84c330b62beee7dab83764f373eaf80414b2516e/lib/marked.js#L23

alrra pushed a commit to webhintio/hint that referenced this issue Jan 22, 2018
An issue within the `html` regex in the markdown parser `marked`
(see: markedjs/marked#1032) makes the current
code not be correctly parsed for the site.

Adding blank lines between the comments and the HTML code temporarily
fixed the issues.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Ref webhintio/webhintio.github.io#364
Fix webhintio/webhintio.github.io#364

Close #771
@Feder1co5oave
Copy link
Contributor

Feder1co5oave commented Jan 23, 2018

There sure are a lot of \n inside the html regex...
Commonmark.js parses this as expected.
I'g flag this for 0.4 and categorize under html (/mixed content ?)

Thanks for reporting this @qzhou1607 !

@joshbruce
Copy link
Member

Sounds fair. I don't know the specs well enough to understand their stance on comments. Logically it's just part of HTML - but I'm weird when it comes to my Markdown (avoid putting HTML in there like the plague). :)

@joshbruce joshbruce added this to the 0.4.0 - No known defects milestone Jan 24, 2018
@joshbruce joshbruce added L2 - annoying Similar to L1 - broken but there is a known workaround available for the issue category: mixed content and removed question labels Jan 24, 2018
@joshbruce
Copy link
Member

#985

@joshbruce joshbruce added this to To Do in No known issues Jan 24, 2018
@joshbruce joshbruce removed this from the 0.4.0 - No known defects milestone Apr 4, 2018
No known issues automation moved this from To Do to Done Apr 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: mixed content L2 - annoying Similar to L1 - broken but there is a known workaround available for the issue
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants