References
Dendron allows you to reference content from other notes and embed them in your current note.
Currently, Dendron supports 3 types of references:
- note references
- block references
- block range references
References have the following syntax
![[ NAME_OF_NOTE
#STARTING_HEADER # optional
:#ENDING_HEADER # optional
]]
- NOTE: Dendron recently switched the note ref syntax for
((ref: [[foo]]))
to![[foo]]
. The videos have not yet been updated to reflect this change
Configuration
- note references by default come with an outline. you can set the following to
false
in the settings to disable this behavior
"markdown-preview-enhanced.renderRefWithOutline": true
Commands
You can create a ref either by hand or using the Copy Note Ref
command.
Copy Note Ref
- shortcuts:
- key:
ctrl+shift+r
- mac:
cmd+shift+r
- when:
editorFocus
- key:
Copies a reference to the current open document
Lets you quickly create a note reference to the current note.
If you have a header selected while running this command, it will copy the note ref with the selected header to the next note ref
Note Reference
A note reference will include the entire contents of a note within another note. Below is an example of a note reference.
![[dendron.demo.refs.sample]]
Note that references also respect the wildcard operator. The following example will include all child pages of sample.
![[dendron.demo.refs.sample.*]]
Block Reference
A block reference will include the entire contents of a note starting from a specified heading.
![[demo.embed.block#head1]]
Block Range Reference
A block range reference will include the contents of a note starting from a start
header and ending at a end
header.
![[demo.embed.block#head1:#head3]]
Note Reference Offset
A note reference offset is a way to skip a number of lines when using a note reference. The syntax is ,{number}
. Below is an example of using a note reference offset to offset an initial heading, skipping the actual header when doing the embeding.
- NOTE: currently, note reference offsets are limited to the first anchor inside a block reference. They must also be a positive value
![[demo.embed.block#head1,1]]
Wildcard Header Reference
When you're referencing a header by reference, sometimes you don't care what the next header is, just that the reference covers all text up to the next header. You can now specify this using the *
symbol in a header reference.
For example, the following would reference the content from header1 to the next header.
![[demo.embed.block#head1:#*]]
Recursive Reference
Note references can refer to notes with references inside. Dendron current supports references two levels deep. This applies to both the local preview as well as publishing.
Wildcard Note Refs
Note references accept the *
operator at the end which lets you grab all notes of a given level of hierarchy. This also works with typical note reference operation like block selection which means you can use it to grab specific blocks from every note in a level.