pandoc-crossref icon indicating copy to clipboard operation
pandoc-crossref copied to clipboard

How to make wrapping `<div>` not break a paragraph?

Open UlyssesZh opened this issue 1 year ago • 15 comments

test.yml:

tableEqns: true
eqnBlockTemplate: |
  <table><tr><td>$$t$$</td><td>$$i$$</td></tr></table>

test.md:

test
$$x$$
test
$$y$$ {#eq:test}
test

Run:

pandoc -f markdown -t html5 -M crossrefYaml=test.yml -F pandoc-crossref test.md

Output:

<p>test <span class="math display"><em>x</em></span> test</p>
<div id="eq:test">
<table>
<tr>
<td>
<span class="math display"><em>y</em></span>
</td>
<td>
<span class="math display">(1)</span>
</td>
</tr>
</table>
</div>
<p>test</p>

Expected:

<p>test <span class="math display"><em>x</em></span> test <div id="eq:test">
<table>
<tr>
<td>
<span class="math display"><em>y</em></span>
</td>
<td>
<span class="math display">(1)</span>
</td>
</tr>
</table>
</div> test</p>

Here is the reason why I need this. I am trying to use CSS to have indents on the first line of each paragraph (like p { text-indent: 2em; }). Generally I want to control whether the texts after a displayed equation should be a new paragraph or not, so I don't want the wrapping <div> to break the paragraph if I don't include an empty line in the Markdown.

In the code snippet above, we can see that the behavior of displayed equation is already expected by me when it does not have a label. Therefore, this is not a bug of pandoc.

UlyssesZh avatar Jul 01 '24 09:07 UlyssesZh