Supose that I have a directory containing among others two markdown files
a note.md
another one.md
with the a note.md containing
Here is a description of an idea.
![[another one.md]]
and the another one.md containing
Here is another idea related to it.
I am looking for a command in bash that would
- take
a note.md, - replace that the reference
![[another one.md]]in thea note.mdwith the actual contents of theanother one.md, and - return the result (so that I could pipe it to Pandoc).
The output in this example would contain
Here is a description of an idea.
Here is another idea related to it.
Why? Obsidian markdown note-taking app allows embedding file contents into markdown files using ![[]] as described above. However, when converting such files using Pandoc, the references are treated as text. So I am looking for a way to add the embedded content prior to Pandoc conversion.
If you can use perl :
-ioption changes "a note.md", so you may want to do a backup before running the command.@jhnc provided a much safer version :