CommonMark/Markdown Java parser with source level AST. CommonMark 0.28, emulation of: pegdown, kramdown, markdown.pl, MultiMarkdown. With HTML to MD, MD to PDF, MD to DOCX conversion modules.
Processing a document I found that FootnoteRepository.addFootnoteReference:46 is called every time a reference is found.
But since footnoteBlock.setFirstReferenceOffset(footnote.getStartOffset()); is called and not addFirstReferenceOffset, the offset is rewritten every time.
I think the following code will work, but I ask you if I'm not wrong with my analysis.
if (! footnoteBlock.isReferenced()){
footnoteBlock.setFirstReferenceOffset(footnote.getStartOffset());
}
else{
footnoteBlock.addFirstReferenceOffset(footnote.getStartOffset());
}
and correct the method into (because "first" implies "<")
public void addFirstReferenceOffset (int firstReferenceOffset){
if (firstReferenceOffset < this.firstReferenceOffset){
this.firstReferenceOffset = firstReferenceOffset;
}
}
Processing a document I found that
FootnoteRepository.addFootnoteReference:46
is called every time a reference is found. But sincefootnoteBlock.setFirstReferenceOffset(footnote.getStartOffset());
is called and notaddFirstReferenceOffset
, the offset is rewritten every time. I think the following code will work, but I ask you if I'm not wrong with my analysis.and correct the method into (because "first" implies "<")
The code I'm using is as simple as
and
Please provide as much information about where the bug is located or what you were using:
Parser
HtmlRenderer
Formatter
FlexmarkHtmlParser
DocxRenderer
PdfConverterExtension
I've tried every combination of the following options
But without any success (and then I found the problem I described in the beginning).
Am I wrong in my analysis?
To reproduce the problem:
output: