quartz: Add support for Obsidian embedded blocks
Is your feature request related to a problem? Please describe. One important feature missing from Quartz that makes it useful for publishing digital gardens is transclusion.
In Obsidian, this is implemented as custom Markdown syntax (i.e. !^dcf64c
– see Obsidian docs).
As this is not generic Markdown syntax, currently, transcluded blocks appear in Obsidian, but not in Quartz. Quartz sites show malformed markup when attempting to use this syntax, making it impossible to publish richly transcluded notes.
Describe the solution you’d like Quartz sites should render transcluded blocks.
The simplest solution would be an additional compile step similar to how backlinks are generated, with transcluded content statically inserted into a note as if it was originally there.
A more complicated solution would involve transcluded content being styled differently, with a deeplink back to its original context.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 13
- Comments: 20 (6 by maintainers)
+1 for having this feature! It can be super useful, specially in long documents such as courses notes.
I’ve outlined my whole publishing workflow here: https://notes.aadam.dev/SBYNtPHqsTW9Ck1Kuoxsu/
Keep in mind that this was designed with my particular requirements, so it’s not very flexible at the moment.
I have a separate
notes
repo which only contains the Obsidian Vault. I didn’t like the Quartz default approach of making thecontent
directory your repo. My Obsidian Vault doesn’t have any particular structure to follow, in order to be used by some publishing framework, like Hugo, Zola, Gatsby, etc. I’ve decoupled it so that I can easily change the publishing workflow/tooling without having to modify the vault in any way.What I’m doing is that once a change is pushed to the vault, it will trigger a GitHub Action, which will download my modified Quartz theme, use
obsidian-export
to process/embed the notes, and then build and deploy those notes togh-pages
branch.I’ve made some small modifications to the
obsidian-export
tool, so it also outputs the information of the embedded documents in some div tags, which are hidden by default (I can change their visibility using CSS later on).Here’s the GH Action configuration that I’m using: https://gist.github.com/aadimator/5125fbd8a51b1dd13ba608fe37aacfd4
Here’s my Quartz template: https://github.com/aadimator/quartz. This doesn’t have any major changes, just some basic styling and metadata changes.
Here’s my modified
obsidian-export
: https://github.com/aadimator/obsidian-export. I have no experience with Rust, so the code probably is not idiomatic, and it might have several bugs, but for the time being, it’s working fine for me. I might refactor it once I’ve learned Rust.Here’s my modified
hugo-obsidian
: https://github.com/aadimator/hugo-obsidian. I needed to change it because I wanted to use permanent IDs as my URLs. All of my notes have aid
property in the YAML metadata. It uses that as a URL.Let me know if you need any further information.
@jackyzha0 I just tested it with two example Obsidian notes, you can see here in Obsidian, I can embed blocks:
and here, the same Markdown files in VSCode. The Markdown file contains the id
^b7e3ea
.Doesn’t this mean that Quartz should be able to read
^b7e3ea
in one Markdown file, and references to^b7e3ea
in other files, and parse them as references?