jupyterlab-myst icon indicating copy to clipboard operation
jupyterlab-myst copied to clipboard

Footnotes must be defined in the same cell

Open agoose77 opened this issue 2 years ago • 2 comments

Describe the bug

context When I add a footnote with some sentence [^footnote] and [^footenote]: ...

expectation I expected a wild footnote to appear

bug But instead the raw footnote markup is rendered.

Reproduce the bug

  1. Add two Markdown cells
  2. Define a footnote in cell (2), and reference it in cell (1)

List your environment

No response

agoose77 avatar Feb 15 '23 13:02 agoose77

This is potentially going to be tricky. Right now we parse markdown in a per-block basis to speed things up a bit. Currently the footnote reference is resolved by the tokenizer (markdown-it), not the AST, which means if it isn't found the reference is interpreted as text, and we can't resolve it later.

There are a few options:

  1. we could fork the markdown-it footnotes (or have our own implementation of that that is a bit simpler);
  2. we could parse the whole notebook together every time: getting the content back to every cell is harder, and there is a bit or a performance hit
  3. we could say this is a constraint.

If we want the feature, I think that (1) would be the way to go.

rowanc1 avatar Feb 15 '23 15:02 rowanc1

Any plan to fix this?

Here's is how I used jupyterlab-myst:

  1. create markdown file
  2. use python notedown module to convert it to *.ipynb
  3. load the converted *.ipynb in jupyterlab

I'm using vscode extension "Markdown Footnotes" (by Matt Bierner), and it will create footnotes definition at the end of the markdown file, and finally break.

Another question, even I managed to put the definition and link into one cell, the definition will just showed as tooltip. Is this by design? Would it be possible to show the definition always at the end of the cell/notebook?

zillionare avatar Feb 20 '24 12:02 zillionare