Arithmatex and tight lists #1957
-
Hi! The syntax of Arithmatex for block equations requires that they are preceded and followed by an empty line. Is it possible to use block equations within a tight list? I believe this requires the absence of empty lines and, for a reason that is not completely clear to me, disrupts my list. The item containing the block equation looks fine but the following item requires an extra empty line which turns the list into a loose one. I would like to construct a tight list like follows
Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I'm not sure I understand what the question is. Markdown uses blocks. Blocks are separated by new lines. How do I have two separate paragraphs if I push them together? - I am a paragraph.
Am I a new paragraph
or am I a continuation? Tight lists vs loose lists are often based on content. If I have a single paragraph, we can get away with not wrapping the content in a - I am a paragraph <li>I am a paragraph</p> If we have two paragraphs, we must wrap them so they are displayed properly. - I am a paragraph
Am I a new paragraph
or am I a continuation?
Even if I let you smoosh the paragraphs and Arithmatex block together, it isn't going to render as a tight list, it will render as a loose list with the paragraphs before and after wrapped in Or are you complaining about the list not being "tight" in the source, and you don't care about the rendering? In that case, we're talking about something different. Is this what you want?
Each block above is a new paragraph, why are we not separating them as such? I cannot display two paragraphs normally without a new line, so why should math blocks be any different? This is this way because Python Markdown encourages this approach. To get what your asking, you have to do more work to get that. Could we force the above to be handled as separate blocks? Technically, we could. It is a bit more complicated, and I see little gain to test every paragraph looking for a potential math block and then trying to parse it as multiple blocks, but we could technically attempt to start splitting paragraphs if we find block math syntax. I think it is far more explicit and clear to have the blocks separated as separate blocks as that is literally how they are represented in HTML, and by default, that is what works best in Python Markdown, but we could potentially force it to figure this out for us. I would consider this a low priority request, but it is something we could consider. If you absolutely need to have math parsed without new lines, you could registered the provided Math SuperFences blocks as mentioned here: https://facelessuser.github.io/pymdown-extensions/extensions/arithmatex/#alternative-math-blocks. Then you can do something like this:
It still renders as loose, but your source will be "tight". The reason this works is because code blocks are parsed very differently. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
I'm not sure I understand what the question is. Markdown uses blocks. Blocks are separated by new lines.
How do I have two separate paragraphs if I push them together?
- I am a paragraph. Am I a new paragraph or am I a continuation?
Tight lists vs loose lists are often based on content. If I have a single paragraph, we can get away with not wrapping the content in a
<p>
tag and just allow it to be wrapped by the<li>
tag. This is a tight list.- I am a paragraph
If we have two paragraphs, we must wrap them so they are displayed properly.
- I am a paragraph Am I a new paragraph or am I a continuation?