Replies: 3 comments 1 reply
-
|
Tricky. Technically, I think this isn't a bug, because Math is an Inline construction, and in commonmark, indicators of block structure take precedence over indicators of inline structure. (That is, we parse block structure first, then parse paragraph blocks using the inline parser.) It's definitely surprising, though. If you enable the |
Beta Was this translation helpful? Give feedback.
-
|
In case my previous example was too artificial, And the commonmark_x reader will parse it as a list. Switching to gfm style math blocks could avoid this problem, If that breaks the commonmark tradition, |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the explanation. I mistakenly thought that display math were blocks.
I don't think a block parser for display math would be very useful. For me, almost all my display math elements live inside a paragraph, and I can't think of an example from papers I've read where that wasn't the case.
I think I'll just stick to the default pandoc markdown reader, which clearly does some dark magic to get around this problem and fits my mental model much better.
On Apr 1, 2026 at 12:06 AM +0800, John MacFarlane ***@***.***>, wrote:
Math is an inline element (even display math). However, one thing we could do is add a block parser for display math that can't interrupt a paragraph. It would insert a paragraph containing just one display math element. (So, this would be used when you had a blank line in front.) This would allow your example to work, except when it is inside a paragraph.
—
Reply to this email directly, view it on GitHub<#11559?email_source=notifications&email_token=AD7XMQTTSNBXHSPRMPYDS634TPUJBA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCNRTHE3TENBVUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVRTG633UMVZF6Y3MNFRWW#discussioncomment-16397245>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AD7XMQSWVS4ERRKDJVHNWZL4TPUJBAVCNFSM6AAAAACXHHOA6SVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTMMZZG4ZDINI>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description. I am gradually converting from the (default) markdown reader to commonmark_x reader. I am confused about the following behavior of the commonmark_x reader, which seems like a bug to me.
Using the commonmark_x reader, pandoc will convert the following
to:
Obviously, the desired output (i want) is the display math$-a$ , which is the output of the default pandoc reader.
If one removes the space between
-anda,then commonmark_x reader will parse the previous input as a math block.
Beta Was this translation helpful? Give feedback.
All reactions