Mathpix / mathpix-markdown-it

Markdown rendering + Latex extras (equations, tables, ...), with conversion features, for the scientific community
MIT License
542 stars 45 forks source link

BAD footnote line numbering #321

Open junfengye opened 7 months ago

junfengye commented 7 months ago

How to reproduce

import { MathpixMarkdownModel as MM } from "mathpix-markdown-it";

const content = `
text1text1text1...
text1text1text1...
text1text1text1...
\\footnotetext{
* Corresponding author: blablabla...

E-mail address: blablabla...
}

text2text2text2...
text2text2text2...
text2text2text2...
`;

console.log("mmd text:")
console.log(content);

const footnoteHtml = MM.markdownToHTML(content, {lineNumbering: true});

console.log("bad footnote line numbering:")
console.log(footnoteHtml);

const disableFootnoteHtml = MM.markdownToHTML(content, {lineNumbering: true, isDisableFootnotes: true});

console.log("bad footnote area:")
console.log(disableFootnoteHtml);

Input mmd text

image

Output html with lineNumbering=true

<div class="preview-paragraph-1 preview-line 1 2 3 4 5 6 7 8 9" data_line_start="1" data_line_end="9" data_line="1,10" count_line="9">text1text1text1…<br>
text1text1text1…<br>
text1text1text1… </div>
<div class="preview-paragraph-10 preview-line 10 11 12" data_line_start="10" data_line_end="12" data_line="10,13" count_line="3">text2text2text2…<br>
text2text2text2…<br>
text2text2text2…</div>
<hr class="footnotes-sep">
<section class="footnotes" style="margin-bottom: 1em;">
<ol class="footnotes-list" style="padding-left: 20px; margin-bottom: 0;">
<li id="fn1" class="footnote-item" style="list-style-type: none;"><ul class="preview-paragraph-1 preview-line 1 2" data_line_start="1" data_line_end="2" data_line="1,3" count_line="2">
<li>Corresponding author: blablabla…</li>
</ul>
<div>E-mail address: blablabla…</div>
</li>
</ol>
</section>

Output html with lineNumbering=true and isDisableFootnotes=true

<div class="preview-paragraph-1 preview-line 1 2 3 4" data_line_start="1" data_line_end="4" data_line="1,5" count_line="4">text1text1text1…<br>
text1text1text1…<br>
text1text1text1…<br>
\footnotetext{</div>
<ul class="preview-paragraph-5 preview-line 5 6" data_line_start="5" data_line_end="6" data_line="5,7" count_line="2">
<li>Corresponding author: blablabla…</li>
</ul>
<div class="preview-paragraph-7 preview-line 7 8" data_line_start="7" data_line_end="8" data_line="7,9" count_line="2">E-mail address: blablabla…<br>
}</div>
<div class="preview-paragraph-10 preview-line 10 11 12" data_line_start="10" data_line_end="12" data_line="10,13" count_line="3">text2text2text2…<br>
text2text2text2…<br>
text2text2text2…</div>