-
Notifications
You must be signed in to change notification settings - Fork 878
3.8 - Layout issues #1526
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
Comments
I won't be running your whole documentation, but I will run the specfic example you gave. I see you are using the So here is your example using Python Markdown 3.7: import markdown
text = '''
<div style="display: inline-flex" markdown>
<div class="circle"></div>AAAAA<div class="circle"></div>BBBBB<div class="circle"></div><span>CCCCC</span>
</div>
'''
html = markdown.markdown(text, extensions=['md_in_html'])
print(html) <div style="display: inline-flex">
<div class="circle"></div>
<p>AAAAA<div class="circle"></p>
</div>
<p>BBBBB
<div class="circle"></div></p>
<p><span>CCCCC</span>
</div></p> Notice that it produces invalid HTML. Now let's run it in Python Markdown 3.8: <div style="display: inline-flex">
<div class="circle"></div>
</div>
<p>BBBBB
<div class="circle"></div></p>
<p><span>CCCCC</span></p>
</div> Output is still not valid and yes, I do see some content getting dropped which should be fixed, but if we use import markdown
text = '''
<div style="display: inline-flex" markdown>
<div class="circle"></div>
AAAAA
<div class="circle"></div>
BBBBB
<div class="circle"></div>
<span>CCCCC</span>
</div>
'''
html = markdown.markdown(text, extensions=['md_in_html'])
print(html) In both Python Markdown 3.7 and 3.8 we get valid, expected output. <div style="display: inline-flex">
<div class="circle"></div>
<p>AAAAA</p>
<div class="circle"></div>
<p>BBBBB</p>
<div class="circle"></div>
<p><span>CCCCC</span></p>
</div> So, yes, there is an edge case to fix in Python Markdown 3.8 as it should not drop content, but the HTML will still come out invalid if you continue approaching your One of the changes in |
If I had to guess, I think the first |
I think I found the issue |
I have a PR up which should now output the following for your example. Output is still invalid, we just aren't dropping any content anymore. I would recommend you update your content to use <div style="display: inline-flex">
<div class="circle"></div>
<p>AAAAA<div class="circle"></p>
</div>
<p>BBBBB
<div class="circle"></div></p>
<p><span>CCCCC</span>
</div></p> |
Possible not a full example, I carved out quite a lot in making the much smaller example that reflected what I saw happening - for which the Pleased you found something though and will be happy to test locally once released. |
You can test the PR branch now if you like. |
Using the sample project I created, just tested with the following in the
and the output between 3.7 and 3.8 is structurally the same. So, thank you for that 👍 |
@tgit-hub Thanks for trying it out! That helps us ensure we aren't missing anything else. |
I've done a complete rebuild of the main site and that appears to be OK now - albeit only a cursory glance at a couple of the "problem" pages. Will have a chance to go through more tomorrow. Will also take a look at linting the output as well, just to see how much "bad" html is being generated and correct where appropriate. Again, thank you for the prompt change. |
Introduction
The recent release of 3.8 has resulted in some layout issues for me and I am attempting to determine if I need to change my generated pages or if this is a problem with this release. If this is a "me" problem, then I have 2 years worth of docs (1,000+) to review and change before I can switch to 3.8.
I have narrowed down one issue and attached is a simple docker-compose project with three services - 3.7, 3.8 and 3.8-fix - that highlights the issue and a potential change I need to make, albeit that the results are not identical to 3.7.
The issue identified concerns the layout/format of multiple
div
tags. One example being:Docker
The are three docker projects, each contain 4 files, a
Dockerfile
, a pythonrequirements.txt
, an mkdocs configuration file and a sampleindex.md
.The 3.7 and 3.8 projects differ only in pinning the version of markdown and 3.8-fix is the same as 3.8 but with a few minor changes to
index.md
to mitigate and attempt to resolve the layout issues.markdown-3.8-problem.tar.gz
Should be a simple case of extracting and running:
docker compose up --build
and then browse to http://localhost:8037/ http://localhost:8038/ and http://localhost:8039/
Screenshots
The text was updated successfully, but these errors were encountered: