mkdocs-jupyter icon indicating copy to clipboard operation
mkdocs-jupyter copied to clipboard

Cross-reference in Notebooks markdown cell not rendered correctly

Open thomasmarwitz opened this issue 9 months ago • 2 comments

When I reference something from my API documentation, I'd expect this to work even inside jupyter notebooks as it does inside normal mkdocs pages with the mkdocstrings plugin.

For example, I want to be able to write this in a markdown cell in jupyter notebook:

[`MetaLearner.fit`][metalearners.metalearner.MetaLearner.fit]

and it should be rendered as a link pointing to the API method as it also happens in normal pages:

Image

Current behavior just renders the text:

Image

Have you encountered something like this before? At some point, the resolving of the references needs to be injected into the process before being rendered to plain html.

Happy to work on a solution.

thomasmarwitz avatar Feb 18 '25 15:02 thomasmarwitz

Yeah, thats a known limitation. The issue is we render the notebook using nbconvert and it doesnt know its part of mkdocs. I imagine there is a way to maybe pass the MD to mkdocs so it handles those references. Thats probably easier than hacking into nbconvert to handle that.

danielfrg avatar Feb 18 '25 15:02 danielfrg

Are you open to contributions to address this?

I have a branch here that implements this by leaving the content of Markdown cells as top-level content in the parsed notebook HTML, which allows MkDocs to process it instead.

filaretov avatar May 19 '25 17:05 filaretov