Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Foot notes appear repeated #53

Open
rliberoff opened this issue Jul 18, 2024 · 2 comments
Open

Foot notes appear repeated #53

rliberoff opened this issue Jul 18, 2024 · 2 comments

Comments

@rliberoff
Copy link

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&amp;se=2024-07-19T12%3A00%3A51Z&amp;sr=b&amp;sp=r&amp;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&amp;se=2024-07-19T12%3A00%3A51Z&amp;sr=b&amp;sp=r&amp;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!

@BSOFH
Copy link

BSOFH commented Jul 24, 2024

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"
	}

Screenshot 2024-07-24 at 08-31-01 Markdown Test

@julientaq
Copy link

julientaq commented Dec 16, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants