Collecting my attempts to improve at tech, art, and life

Obsidian Export

Does any of this enlighten, entertain, or otherwise please you? Please consider a Tip. Every little bit helps!

ℹ️ Note

Obsidian Sync doesn’t copy dotfiles. .export-ignore needs to be added on every platform that you’re running obsidian-export.

GitHub - zoni/obsidian-export: Rust library and CLI to export an Obsidian vault to regular Markdown

A Rust library and CLI tool for exporting Obsidian vault contents into regular Markdown. This cuts down a few steps for your Static Site Generator or other processing scripts.

There’s curl-bash installation instructions corresponding to specific versions on the Releases page.

using obsidian-export with Hugo

Hugo

The obsidian-export README provides sample templates

Turns ../../Card/ADHD.md to /card/adhd.

layouts/_default/_markup/render-link.html
    {{- $url := urls.Parse .Destination -}}
{{- $scheme := $url.Scheme -}}

<a href="
  {{- if eq $scheme "" -}}
    {{- if strings.HasSuffix $url.Path ".md" -}}
      {{- relref .Page .Destination | safeURL -}}
    {{- else -}}
      {{- .Destination | safeURL -}}
    {{- end -}}
  {{- else -}}
    {{- .Destination | safeURL -}}
  {{- end -}}"
  {{- with .Title }} title="{{ . | safeHTML }}"{{- end -}}>
  {{- .Text | safeHTML -}}
</a>

{{- /* whitespace stripped here to avoid trailing newline in rendered result caused by file EOL */ -}}
  

Transforming images

layouts/_default/_markup/render-image.html
    {{- $url := urls.Parse .Destination -}}
{{- $scheme := $url.Scheme -}}

<img src="
  {{- if eq $scheme "" -}}
    {{- if strings.HasSuffix $url.Path ".md" -}}
      {{- relref .Page .Destination | safeURL -}}
    {{- else -}}
      {{- printf "/%s%s" .Page.File.Dir .Destination | safeURL -}}
    {{- end -}}
  {{- else -}}
    {{- .Destination | safeURL -}}
  {{- end -}}"
  {{- with .Title }} title="{{ . | safeHTML }}"{{- end -}}
  {{- with .Text }} alt="{{ . | safeHTML }}"
  {{- end -}}
/>

{{- /* whitespace stripped here to avoid trailing newline in rendered result caused by file EOL */ -}}
  

Jots

Obsidian Sync doesn’t copy dotfiles. .export-ignore needs to be added on every platform that you’re running obsidian-export. So, better keep track of My export-ignore

Transforms unavailable links into unlinked italicized text during export.