What I’m trying to do
I would like to embed the contents of multiple note-files so that in Reading Mode, they are displayed inside one single code block.
OR
Have a single embedded note-file display inside a code block even if the original note is not wrapped in a code block.
Example
I have two note files with the following contents:
File 1: “FileA.md”
# Header
## Item 1
Descriptive text.
File 2: “FileB.md”
## Item 2
Descriptive text.
## Item 3
More descriptive text.
In another note, I use embedded links so that they both display together,
File 3: “CombinedNote.md”
![[FileA]]
![[FileB]]
And doing that in Edit mode will show this is Reading Mode, as intended:
File 1: “FileA.md”
Header
Item 1
Descriptive text.
Item 2
Descriptive text.
Item 3
More descriptive text.
So far, so good, this is fine for referencing. However, what I would like to then wrap these embedded links inside a code block, so it looks like this when in Reading Mode and viewing “CombinedNote”:
# Header
## Item 1
Descriptive text.
## Item 2
Descriptive text.
## Item 3
More descriptive text.
Why I Want To Do This
My aim here is two-fold:
I’m trying to make my notes more modular, so I can have multiple notes that have the same beginning sections but different ending or middle sections, and I would like to be able to edit the “core” section and have it automatically update across all notes that use it. Simply embedding the files is good enough to do this much, but that brings me to the second reason:
I’d like to be able to easily and quickly copy and paste different sections that are “combined” this way, and code blocks generated with three back-ticks or tildes have a little button that copies the whole block.
As a third side-reason (not as important), I’d like to be able to display both the raw input (like a code block would show) AND the formatted output of an embedded note file at the same time in Reading View.
Things I have tried
- Wrapping the embed links in back-ticks. This simply rendered a code block that showed the raw embed link instead of the file contents inside a code block (as expected).
- Putting three back-ticks at the beginning of FileA and another set of “closing” back-ticks at the end of FileB, hoping the embedded version would open and close the code block between them. This did not work, it just rendered each set of back-ticks as their own independent code blocks.
- TABBING/Four-Spacing before each line in both FileA and FileB hoping that after rendering, it would render as one continuous code blocks. This resulted in something that looked like it was one single code block, but it actually had two different blocks each with its own independent copy button.
- Scouring for and testing several plugins that kind of sounded like they could do what I was hoping to do, but none of them did what I wanted them to. I admit, though, this could just be a failing of my own search terms or vocabulary. This is kind of a complicated thing to describe accurately (as you might have noticed) and I am unaware of a more widely-used term by the community that encompasses it (I’m not at all experienced in coding, even CSS or HTML).
- Crying from frustration. This had the expected result, but was not helpful.