Obsidian Publish is great but lacks support for many of the plugins we Obsidian addicts have grown accustomed to — in particular Dataview, but also Citations, Admonition, and more.
This plugin lets you export your md
notes to html
static files for self-hosting. It supports a bunch of popular plugins.
For an example, check out my personal website. (You can see it's still a little wonky, but it's getting there.)
- As with Obsidian Publish, you just need to include a
published: true
field in your metadata for a note to be included in the export. - You can add a
slug: "some-slug"
orslug: ["one", "of", "several", "slugs"]
to specify the slug of the file produced. Otherwise, it's just thekebab-case
of your note name. - By default, links to unpublished notes will be removed. However, you can include an
external
field in an unpublished note's metadata. Then, the link will be transformed to point to the value ofexternal
.
%% In "My Random Note" %%
---
published: true slug: "custom-slug"
external: https://www.random.org/
---
- If `published` is true, this file will be included in the export. Just like Obsidian Publish.
- If `slug` is not explicitly provided, it defaults to `my-random-note`.
- If you provide multiple slugs, e.g., `["custom-slug-1", "custom-slug-2"]`, then the note will be exported to a file whose name is the first provided slug. Eventually, I'd like to add support for redirecting additional slugs to the first.
- If `published` is `false`, links to this note will be replaced with `https://www.random.org/`
You can create a custom template to wrap your notes in template.html
(put this in your vault's top-level directory). This uses mustache, with the following options
{
nav: {
brand: string,
items
:
{
label: string, href
:
string
}
}
,
// Already rendered:
main: string, // This is where your note's contents go
head
:
string,
footer
:
string,
}
You can also provide custom styling in a publish.css
(again in your vault root). Currently, your snippets, theme, and obsidian.css
are all included in the export. (There is no option yet to opt out).
This plugin uses remark under the hood to do the converting. It uses a set of plugins to recreate "Obsidian-flavored markdown", including:
- remark-gfm
- remark-frontmatter
- remark-math
- remark-mermaidjs
- remark-numbered-footnote-labels
- remark-wiki-link
- remark-cite
Plus a few new modifications to do things like comments and embed wikilinks ![[]]
. Eventually, I'll probably publish this as a new remark plugin (so you can access Obsidian-flavored markdown in other projects). Conversely, I'll add support for arbitrary remark plugins, so you have even more to choose from.
- Dataview (partial).
- You can use
dataviewjs
blocks and inline attributes.dataview
blocks and inline blocks are still unsupported.
- You can use
- Citations.
- Buttons (only for link buttons)
- CustomJS
- Core
- Basics
- Fix/remove links (using
slug
andexternal
) - CSS snippets
- Obsidian theme
- HTML templates to wrap exported files
- Fix/remove links (using
- "Obsidian-flavored markdown"
- Wiki-links
- Embed wiki-links
- Images
- PDFs
- Page embeds
- Block embeds
- Tags (
#abc
) - Block ids (
^123456
) - Comments (
%% ... %%
). This plugin currently just ignores comments. Another option would be to convert to html comments. - Highlighting (
==...==
)
- Basics
- Plugins
- Dataview
- Code blocks
-
dataviewjs
blocks -
dataview
blocks - inline blocks
-
- Inline attributes (currently just disregarding the key)
- Code blocks
- Citations
- Buttons (only for link buttons)
- Admonition
- CustomJS
- Breadcrumbs
- Dataview