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

Markdown parser produces invalid HTML #384

Closed
solomax opened this issue Jan 22, 2020 · 10 comments
Closed

Markdown parser produces invalid HTML #384

solomax opened this issue Jan 22, 2020 · 10 comments

Comments

@solomax
Copy link

solomax commented Jan 22, 2020

After upgrading maven-site-plugin to 3.8.2 I found weird output:

line [3] Error parsing the model: end tag name </p> must match start tag name <div> from line 3 (position: TEXT seen ...out bd-callout-danger"> It should be run under same user as OM</p>... @3:271)

As a result https://issues.apache.org/jira/browse/MSITE-854 has been filed
During investigation Michael Osipov find out the bug should be reported here

could you please take a look?

The markdown being parsed is very simple: https://github.com/apache/openmeetings/blob/master/openmeetings-server/src/site/markdown/InstallMediaServer.md

@michael-o
Copy link

I am curious what causes the bug.

@vsch
Copy link
Owner

vsch commented Jan 22, 2020

@solomax, can you please tell me what the issue is with the generated HTML. I ran the source through tests on master branch (upcoming 0.60 version), 0.50 and 0.42 and in all cases the result is the same and I cannot see what is incorrect. Note, that → is a tab character changed in tests to visually show tabs for easy identification, it is a \t in actual source and HTML.

Source:

<!-- 
# Licensed under the Apache License, Version 2.0 (the "License") http://www.apache.org/licenses/LICENSE-2.0 -->

# Media Server Installation

## Install Kurento Media server

<a href="https://doc-kurento.readthedocs.io/en/stable/user/installation.html">Install Kurento Media server</a>
<div class="bd-callout bd-callout-danger">
→It should be run under same user as OM
</div>

## Specify/Install Turn server

<div class="bd-callout bd-callout-info">Optional step</div>

Resulting HTML:

<!-- 
# Licensed under the Apache License, Version 2.0 (the "License") http://www.apache.org/licenses/LICENSE-2.0 -->
<h1>Media Server Installation</h1>
<h2>Install Kurento Media server</h2>
<p><a href="https://doc-kurento.readthedocs.io/en/stable/user/installation.html">Install Kurento Media server</a></p>
<div class="bd-callout bd-callout-danger">
→It should be run under same user as OM
</div>
<h2>Specify/Install Turn server</h2>
<div class="bd-callout bd-callout-info">Optional step</div>

Maybe based on selected options or some post processing after rendering, the generated HTML is not what I am seeing. However, I don't see it in the library generated HTML.

Can you get the parser options used so I can test the exact options instead of CommonMark defaults.

@vsch
Copy link
Owner

vsch commented Jan 22, 2020

@solomax, @michael-o, it would also help to know the version of the library used so I can have identical conditions for the test.

@solomax
Copy link
Author

solomax commented Jan 22, 2020

@michael-o can you please provide the options and the exact version being used? (should be easy for you, since you was able to debug it :))

@vsch
Copy link
Owner

vsch commented Jan 23, 2020

@solomax, @michael-o, the issue is caused by HTML parser in deep html parse mode not interrupting paragraph blocks on HTML block tags.

The bug is fixed in version 0.42.14, repo for branch 0.42 is updated. Maven central updated and may take some time to show the new version.

A workaround is possible by adding a blank line before the <div> tag so that the previous paragraph element is closed so that the HTML block tag will be recognized.

@michael-o
Copy link

@vsch Very nice! @solomax Can you update the dependency locally and try again?

@solomax
Copy link
Author

solomax commented Jan 27, 2020

@vsch, @michael-o
Sorry for delay
Just have checked there is no error with version 0.42.14
Thanks for quick fix!

@solomax solomax closed this as completed Jan 27, 2020
@michael-o
Copy link

@solomax Please another JIRA issue to have flexmark updated with Doxia.

@hboutemy
Copy link
Contributor

hboutemy commented Feb 5, 2020

The bug is fixed in version 0.42.14, repo for branch 0.42 is updated. Maven central updated and may take some time to show the new version.

0.42 branch: a3fcc75
0.50 branch: 40a7fdd
master branch: 1f28ad0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants