question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to respect hidden paragraphs?

See original GitHub issue

Describe the bug

context

I’m migrating a Sphinx project from recommonmark to MyST, and noticed a few unexpected changes in formatting. One is the addition of <p> paragraph tags in list items. Take the following Markdown:

* A Python library
* A Sphinx extension

MyST converts this to:

<ul class="simple">
<li><p>A Python library</p></li>
<li><p>A Sphinx extension</p></li>
</ul>

This example comes from the getting started guide.

expectation

I would have expected:

<ul class="simple">
<li>A Python library</li>
<li>A Sphinx extension</li>
</ul>

This is the output of markdown-it-py, and the markdown-it live demo (not counting the simple class name).

bug

Instead, the <p> tags are added, which means extra vertical spacing and odd content semantics.

problem

I can’t think of a scenario where the extra vertical space, or the semantics, are desirable.

For example, for the MyST documentation, I can see this was worked around of with CSS: https://github.com/executablebooks/sphinx-book-theme/blob/1b5c3889bce036c4116a7e35aed83668ff810357/src/sphinx_book_theme/assets/styles/base/_typography.scss#L46-L52

Reproduce the bug

  1. Create a Markdown document with an unordered or ordered list item
  2. Convert to HTML

List your environment

myst-parser==0.17.0

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
rowanc1commented, Mar 9, 2022

Another stopgap alternative is to change the CSS styling so that visually the outcome is as expected. Semantically it is a bit different (is it data or text). I believe the spread flag in mdast handles this for listItems.

li p, table p {
    margin: 0px;
}
0reactions
thibaudcolascommented, Mar 10, 2022

Looks like this got reported for sphinx 2.0b1, which they decided to fix by adding CSS in one theme 😐.

Testing this with rst2pseudoxml and rst2html – I get the same output as you for the AST, but can confirm the HTML does not have the paragraph tags.

So this increasingly looks like a clear sphinx-specific issue? It’s unclear to me why this came up specifically as part of our switch from recommonmark to MyST, but I assume it’s a dependencies management problem on our side.

Edit: yes, since MyST-Parser has an explicit dependency on sphinx>=3.1,<5, this overwrites the sphinx==1.8.6 we’ve explicitly installed previously, and leads to this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

12 Ways to Show Respect - wikiHow
Listen to others. · Affirm people's opinions. · Empathize with different perspectives. · Disagree respectfully. · Apologize when you're in the wrong. ·...
Read more >
Hidden Text in Word | Western Sydney University
To view (hidden) text. From the Home tab, in the Paragraph group,; Click the Show/Hide button‚. *Tip: Instructions are ...
Read more >
6 Ways to Show Respect in Your Relationship
You can demonstrate trust by not texting or calling your partner constantly. Instead, text or call them once. Leave a message saying that...
Read more >
How to Align and Indent Paragraphs in Word 2019 - dummies
You can see the paragraph markers (which don't print) by clicking the Show/Hide button on the Word 2019 Home tab (in the Paragraph...
Read more >
[Feature Suggestion] Respect .hidden file #342 - Peltoche/lsd
When a user runs LSD in that directory it picks up the .hidden file and then doesn't display any files which match. This...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found