Skip to content

How to embed content from Jupyter Notebook into a separated Markdown file? #1062

Answered by fwkoch
lgonzalezsa asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @lgonzalezsa - I think you are on the right track. There is another mention in the docs here: https://mystmd.org/guide/cross-references#targeting-cells - but I don't think it adds much to the other page you found. All you should need is:

  • notebook and markdown files in the same directory or a subdirectory, relative to your myst.yml file (created with myst init)
  • notebook cell with the first line as #| label: my-label
  • reference to this cell in the markdown file from a figure
    :::{figure} #my-label
    :::
    

A rich example that includes this feature can be found here: https://github.com/Notebooks-Now/submission-myst-full

In this example there is a labelled cell in notebooks/visualization-fig…

Replies: 2 comments 13 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by rowanc1
Comment options

You must be logged in to vote
13 replies
@lgonzalezsa
Comment options

@rowanc1
Comment options

@rowanc1
Comment options

@lgonzalezsa
Comment options

@rowanc1
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants