It is possible to reference figures and content from other DevNotes in your DevNote

The MyST markdown syntax makes it possible to reuse figures from other Developer Notes (also any other document that is built on MyST markdown). In this post, I want to show how this is done.

I will use a specific example where we are putting together a Developer Note where we have built and validated some DNA from a community contributor. He included a nice schematic that I want to reuse - caption and all - without modification since it perfectly describes what we’re building.

Step 1: create a reference in the Developer Note’s curvenote.yml file.

project:
  references:
    contrib-cx43: https://devnotes.bnext.bio/articles/contrib-cx43-cell

Note that the key, contrib-cx43, is totally arbitrary. I could have called it bonk. The key sets how you would reference the figure in the project markdown file…

Step 2: reference the figure in your DevNote.

Now, I’m in my DevNotes main.md file where I’ve decided to use the key word bonk:

[](xref:bonk#fig:connexin-scheme)

Here, #fig:connexin-scheme is the figure label in the source document’s markdown file #fig:connexin-scheme. This allows me to reference the figure in-line and will give me a tool tip if I hover over the link so that I can see the figure in the context of the surrounding text.

I can also bring in the figure as a stand-alone image by adding a ! to the above syntax:

![](xref:bonk#fig:connexin-scheme)

The main challenge is that you have to know the name of the figure label. This might towards a best practice of using a convention like #fig:figure-1 to make it possible for others to easily reference figures across documents.

The other downside is that figures inserted in this manner will not appear as table of content images, i.e. they may not be useful as a first figure of a DevNote.

I’d love to know if others find this useful or how they might think about writing captions if they know that their figures can be pulled into other DevNotes.

1 Like