Foot notes appear repeated
Hello!
I'm using the latest version, and for the following markdown:
The key to succeeding in Asia-Pacific is to strongly engage with Chinese passengers both domestically in China and internationally in neighboring countries such as Thailand, South Korea, and Japan.
The company already has a solid footprint in this area and plans to further expand in existing and new locations.^[https://stkaitorag7d628.blob.core.windows.net/user-documents/user-documents/r_oyorimfisd/Internal.pdf?sv=2024-05-04&se=2024-07-19T11%3A53%3A56Z&sr=b&sp=r&sig=v3wZ%2FmS8pdn%2BDyEORunEROP6IubKgIxSrmieb5gWfdM%3D]
I'm getting the following render:
<p>
The key to succeed in Asia-Pacific is to strongly engage with Chinese passengers domestically in China and when they travel internationally to neighboring countries such as Thailand, South Korea and Japan. The company already has a solid footprint in
this geographic area and plans to further expand in existing and new locations.<sup class="footnote-ref"><a href="#fn2" id="fnref2">[2]</a></sup>
</p>
<hr class="footnotes-sep" />
<section class="footnotes">
<ol class="footnotes-list">
<li id="fn1" class="footnote-item">
<p>
https://stkaitorag7d628.blob.core.windows.net/user-documents/user-documents/r_f16m2hh9sm/Indernal.pdf?sv=2024-05-04&se=2024-07-19T12%3A00%3A51Z&sr=b&sp=r&sig=6DZ9SG10Ee4NDn7yS2aUbwZdWNyZOfBakhy3%2F8ly0qo%3D
<a href="#fnref1" class="footnote-backref">↩︎</a>
</p>
</li>
<li id="fn2" class="footnote-item">
<p>
https://stkaitorag7d628.blob.core.windows.net/user-documents/user-documents/r_f16m2hh9sm/Indernal.pdf?sv=2024-05-04&se=2024-07-19T12%3A00%3A51Z&sr=b&sp=r&sig=6DZ9SG10Ee4NDn7yS2aUbwZdWNyZOfBakhy3%2F8ly0qo%3D
<a href="#fnref2" class="footnote-backref">↩︎</a>
</p>
</li>
</ol>
</section>
As you can see... I'm getting the footnotes repeated. The expected behavior is just one footnote with the correct number.
This is the code in Javascript:
```html
<script crossorigin="anonymous" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/markdown-it.min.js"></script>
<script crossorigin="anonymous" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/markdown-it-for-inline.min.js"></script>
<script crossorigin="anonymous" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/markdown-it-footnote.min.js"></script>
<script crossorigin="anonymous" src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"></script>
//...
<script>
(async function () {
// ...
const iterarator = markdownitForInline;
const markdownIt = window.markdownit()
.use(markdownitFootnote)
.use(iterarator, 'url_new_win', 'link_open', function (tokens, idx) {
let aIndex = tokens[idx].attrIndex('target');
if (aIndex < 0) {
tokens[idx].attrPush(['target', '_blank']);
} else {
tokens[idx].attrs[aIndex][1] = '_blank';
}
})
;
//...
})().catch(err => console.error(err));
</script>
Please help!
At best, I confirm this problem. Initial build is fine, any updates to footnote containing markdown files are corrupted. This shouldn't effect production builds of a site as long as EleventyDevServe is not involved. Since it's a EleventyDevServe issue, one work around is just to open another terminal tab and run the build as needed (without --serve of course) and reload the browser.
I'll be back if I find the bug. Thanks for a wonderful plugin.
My dependencies:
"dependencies": {
"@11ty/eleventy": "^2.0.1",
"@11ty/eleventy-img": "^3.1.1",
"@11ty/eleventy-plugin-bundle": "^1.0.4",
"@11ty/eleventy-plugin-rss": "^1.2.0",
"@11ty/eleventy-plugin-syntaxhighlight": "^5.0.0",
"eleventy-plugin-reading-time": "^0.0.1",
"eleventy-plugin-wordcount-extended": "^0.2.1",
"http-server": "^14.1.1", // installed for this bug
"luxon": "^3.3.0",
"markdown-it": "^13.0.2",
"markdown-it-abbr": "^2.0.0",
"markdown-it-anchor": "^8.6.7",
"markdown-it-attrs": "^4.1.6",
"markdown-it-bracketed-spans": "^1.0.1",
"markdown-it-container": "^4.0.0",
"markdown-it-deflist": "^3.0.0",
"markdown-it-emoji": "^3.0.0",
"markdown-it-footnote": "^4.0.0",
"markdown-it-for-inline": "^2.0.1",
"markdown-it-ins": "^4.0.0",
"markdown-it-mark": "^4.0.0",
"markdown-it-multimd-table": "^4.2.3",
"markdown-it-sub": "^2.0.0",
"markdown-it-sup": "^2.0.0",
"markdown-it-task-lists": "^2.1.1",
"npm-run-all": "^4.1.5",
"rimraf": "^6.0.1"
}
right, so i have the same issue (a bit worse, because the notes are repeated 372 times).
If the note is block [^1] with the note below, the content of the second repeated note is empty.
if the note is inline, the content of the note is repeated until it stops.
It happens on eleventy, on build and on serve. So maybe it’s a bit different.
--- edit
OH so i found something
if i do return md.use(mdfootnote).render(value); it gets repeated.
BUT if i set the configuration like this: let md = markdownIt(options).use(mdfootnote) the repeat is gone.
So i think i have a working solution by setting up the plugins in the config and not when markdown it runs.
The footnote references are stored in the env object for md.render(text, env). Make sure the object is re-created per render call, otherwise footnotes will be repeated in the subsequent render calls.
I'm using this plugin how I believe the eleventy docs recommend, and I'm getting repeated footnotes in all builds, including my prod build.
//.eleventy.js
import markdownItFootnote from "markdown-it-footnote";
...
const mdConfig = {
html: true,
linkify: false,
};
eleventyConfig.amendLibrary("md", (mdLib) => mdLib.configure(mdConfig));
eleventyConfig.amendLibrary("md", (mdLib) => mdLib.use(markdownItFootnote));
https://github.com/gabeklavans/website/blob/080a507dcfc8571e4f534bc77de28e1925367c40/.eleventy.js#L12
Maybe it's an eleventy bug but I figured I'd chime in here first.