Minimalist static .md → .html site generator. Declarative and highly customizable. Built with personal sites and the small web in mind! uteri.klastriz.com
uteri docs IMPORT.md
4.6 kB · 112 lines
Markdown
at main

Import #

uteri import converts an existing Markdown vault into uteri content. It is a one-shot conversion: uteri reads the files it writes, using its own templates and configuration.

uteri import --content ~/vault --out .uteri/content
uteri build --content .uteri/content

--content and --out are both required. Import never writes outside --out and never touches the source.

Import needs no site.conf; it converts files and does not build.

Conventions, not products #

Vaults differ in conventions, not in kind. Import handles three shapes at once:

Shape Example How it works
filename-addressed links [[My Note]] the literal filename becomes an alias
ID-addressed links [[20260101120000]], [[AABBCC]] the stem and any front matter id become aliases
kind or path folders kind: essay, notes/ paths are kept; --by-kind groups by kind
explicit routes path: /sobre/ --use-path writes sobre.md

Because uteri resolves a wikilink through route, alias, title and slug, an alias for every name a note is known by is enough. Links are not rewritten.

A vault that groups by kind usually names its folders differently from the kind values (kind: note → notas/). Say so once per kind:

uteri import --content vault --out content --by-kind \
  --kind-map note=notas --kind-map essay=ensaios --kind-map reference=referencias

Options #

--content DIR   the vault to read (required)
--out DIR       where to write content (required)
--flat          put every note in the output root
--by-kind       put notes in <kind>/ (verbatim), keeping paths otherwise
--kind-map FROM=TO
                with --by-kind, put kind FROM in folder TO (repeatable)
--use-path      use a front matter `path` as the output route
--skip NAME     skip a file or directory by name, at any depth (repeatable)
--status-tags   turn `status: S1` into the tag `S1` (off by default)
--force         write into a non-empty --out
--dry-run       print the planned source -> destination lines, write nothing

--flat and --by-kind cannot be used together. Import refuses a non-empty --out without --force; --force never deletes files it did not write.

Every path segment that starts with a dot is skipped, which covers .git and any tool's hidden state without naming it.

What it changes #

Source Output
Nota ção.md Nota-cao.md (Latin-1 and Latin Extended-A folded)
notes/My Note.md notes/My-Note.md, alias My Note
path: /sobre/ with --use-path sobre.md
created: … when date is absent also date: …
source: bib_source: (source is reserved by templates)
status: S1 with --status-tags added to tags; a list status keeps its first value
draft: "true" draft: true (typed keys are coerced)
![[image.png]] ![](relative/path) and the file is mirrored
![[Some Note]] [[Some Note]]; uteri has no transclusion
front matter aliases kept and merged with the generated ones

Everything else passes through untouched. publish: false needs no mapping: the build already treats it as a draft.

Limits #

  • Front matter must be the flat subset uteri reads: scalars, true/false, inline lists and block lists. A file that does not parse is imported with its body only, with a warning, so nothing is lost.
  • No nesting is preserved inside a single file: a nested map becomes a string or is dropped by the parser.
  • Inline #hashtags stay body text; uteri tags come from front matter.
  • [[Note#^block]] block references keep working only as far as the fragment resolves; there is no block-level anchor.
  • Links are not rewritten inside bodies: embeds and transclusions are the only exceptions.

Re-running #

Import is deterministic: the same vault always produces the same tree. To pick up changes, run it again with --force into the same --out. Files you added or edited by hand are left alone, so review the diff before committing.

As a hook #

The recommended flow is manual: import once, review the result, commit it. A conversion step can also run on every build:

[hook]
pre_build = uteri import --content vault --out .uteri/content --force

pre_build appends the project root and configured content directory as its last two arguments; import ignores those two, because its flags already say what to read and write. The summary goes to stderr, so stdout stays empty and the configured content directory is kept. The process is resolved through PATH, so uteri must be installed.