cyberware/docs/features/OxHugo compatibility.md
Hrishikesh Barman bc543f81d9
feat(plugins): add OxHugoFlavouredMarkdown (#419)
* feat(plugins): add OxHugoFlavouredMarkdown

ox-hugo is an org exporter backend that exports org files to
hugo-compatible markdown in an opinionated way. This plugin adds some
tweaks to the generated markdown to make it compatible with quartz but
the list of changes applied it is not extensive.

In the future however, we could leapfrog ox-hugo altogether and
create a quartz site directly out of org-roam files. That way we won't
have to do all the ritual dancing that this plugin has to perform.
See https://github.com/k2052/org-to-markdown

* fix: add toml to remarkFrontmatter configuration

* docs: add docs for OxHugoFlavouredMarkdown

* fixup! docs: add docs for OxHugoFlavouredMarkdown
2023-08-25 22:52:23 -07:00

1.9 KiB

tags
plugin/transformer

Quartz is a static-site generator that transforms markdown content into web pages. org-roam is a plain-text(org) personal knowledge management system for emacs. ox-hugo is org exporter backend that exports org-mode files to Hugo compatible markdown.

Because the markdown generated by ox-hugo is not pure markdown but Hugo specific, we need to transform it to fit into Quartz. This is done by Plugin.OxHugoFlavouredMarkdown. Even though this making plugins was written with ox-hugo in mind, it should work for any Hugo specific markdown.

plugins: {
  transformers: [
    Plugin.FrontMatter({ delims: "+++", language: "toml" }), // if toml frontmatter
    // ...
    Plugin.OxHugoFlavouredMarkdown(),
    Plugin.GitHubFlavoredMarkdown(),
    // ...
  ],
},

Usage

Quartz by default doesn't understand org-roam files as they aren't Markdown. You're responsible for using an external tool like ox-hugo to export the org-roam files as Markdown content to Quartz and managing the static assets so that they're available in the final output.

Configuration

  • Link resolution
  • Image handling
    • replaceFigureWithMdImg: Whether to replace <figure/> with ![]()
  • Formatting
    • removeHugoShortcode: Whether to remove hugo shortcode syntax ({{}})

Warning

While you can use Plugin.OxHugoFlavoredMarkdown and Plugin.ObsidianFlavoredMarkdown together, it's not recommended because it might mutate the file in unexpected ways. Use with caution.