Quartz's default ox hugo plugin.
  • TypeScript 100%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-09 23:04:12 +01:00
.changeset chore: version package 2026-11-08 13:48:20 +00:00
.github/workflows ci: run ci.yml on the changesets version PR and report it as a commit status 2026-11-09 03:47:27 +01:00
src feat: extract ox hugo transformer from Quartz core 2026-02-13 22:31:03 +01:00
types fix: centralize type declarations and add missing dependencies 2026-03-16 18:54:32 +01:00
.eslintrc.json fix: centralize type declarations and add missing dependencies 2026-03-16 18:54:32 +01:00
.gitignore chore: migrate to npm publishing 2026-07-23 09:07:28 +02:00
.prettierignore fix: centralize type declarations and add missing dependencies 2026-03-16 18:54:32 +01:00
.prettierrc Initial commit 2026-02-13 21:35:43 +01:00
CHANGELOG.md chore: version package 2026-11-08 13:48:20 +00:00
LICENSE Initial commit 2026-02-13 21:35:43 +01:00
package-lock.json chore: version package 2026-11-08 13:48:20 +00:00
package.json chore: version package 2026-11-08 13:48:20 +00:00
README.md docs(readme): Quartz 5.1 — npm install and config, correct options and defaults 2026-11-09 22:57:50 +01:00
tsconfig.build.json fix: use separate tsconfig for DTS build to avoid vitest dependency 2026-03-22 13:12:01 +01:00
tsconfig.json Initial commit 2026-02-13 21:35:43 +01:00
tsup.config.ts build: bundle dependencies and ship pre-built dist 2026-04-27 21:38:14 +02:00
vitest.config.ts fix: add passWithNoTests to vitest config 2026-03-09 03:21:30 +01:00

@quartz-community/ox-hugo

Transforms ox-hugo exported markdown to be compatible with Quartz, handling relref links, Hugo shortcodes, figure tags, and org-mode LaTeX.

Installation

npx quartz plugin add @quartz-community/ox-hugo

Quartz's default configuration has a disabled entry for this plugin; set enabled: true to use it.

Usage

ox-hugo usually writes TOML frontmatter (+++). Quartz's built-in frontmatter parsing reads it when configured under configuration.frontmatter; the ObsidianFlavoredMarkdown plugin's default legacy preset only recognizes YAML frontmatter, so switch it to preset: strict too:

configuration:
  frontmatter:
    delimiters: "+++"
    language: toml
plugins:
  - source: "@quartz-community/obsidian-flavored-markdown"
    enabled: true
    options:
      preset: strict # needed for TOML (+++) frontmatter
    order: 40
  - source: "@quartz-community/ox-hugo"
    enabled: true
    order: 91

The plugin rewrites the Markdown source before it is parsed, so its order relative to the other Markdown plugins doesn't matter. It also lets raw HTML in the exported Markdown through (rehype-raw).

For advanced use cases, you can override in TypeScript (note the British spelling of the function name):

import * as ExternalPlugin from "./.quartz/plugins";

ExternalPlugin.OxHugoFlavouredMarkdown({
  replaceOrgLatex: false,
});

Configuration

Option Type Default Description
wikilinks boolean true Convert Hugo relref links ([text]({{< relref "page" >}})) to Markdown links ([text](page)).
removePredefinedAnchor boolean true Strip predefined anchors ({#id}) from headings.
removeHugoShortcode boolean true Remove Hugo shortcode syntax ({{ … }}), keeping its content.
replaceFigureWithMdImg boolean true Replace <figure src="…"> tags with Markdown images (![](…)).
replaceOrgLatex boolean true Convert org-mode LaTeX fragments to $…$ (inline) and $$…$$ (block).

Documentation

See the Quartz documentation and OxHugo compatibility for more information.

License

MIT