---
title: compileNoteVersion
description: >-
  Compiles `markdown`, a version of the published note `note` that sat at `path`
  in the vault, as the build compiles the note: run `ctx.plugins`'
  `parseFrontmatter` stage on it alone, then their link, OFM and embed stages on
  it among the notes and attachments the build publishes, embedding them from
  the build's own sources, then compile it with the build's compiler steps and
  any its own content alone needs. The version takes the note's place and route,
  and links resolve as they do from the note now.
updated_at: '2026-11-19T23:56:18+01:00'
created_at: '2026-11-19T22:03:58+01:00'
symbol:
  kind: function
  name: compileNoteVersion
  signatures:
    - >-
      compileNoteVersion(ctx:
      [[reference/api/core/PluginContext|PluginContext]], note: { readonly slug:
      string; readonly path: string; readonly href: string }, version: {
      readonly path: string; readonly markdown: string }, options: { readonly
      attachments: readonly
      [[reference/api/core/ProcessedFile|ProcessedFile]][]; readonly prefix:
      string; readonly published: (pathname: string) => boolean; readonly
      moved?: ReadonlyMap<string, string> }):
      Promise<[[reference/api/plugins/CompiledNoteVersion|CompiledNoteVersion]]>
  parameters:
    - name: ctx
      type: '[[reference/api/core/PluginContext|PluginContext]]'
    - name: note
      type: '{ readonly slug: string; readonly path: string; readonly href: string }'
    - name: version
      type: '{ readonly path: string; readonly markdown: string }'
    - name: options
      type: >-
        { readonly attachments: readonly
        [[reference/api/core/ProcessedFile|ProcessedFile]][]; readonly prefix:
        string; readonly published: (pathname: string) => boolean; readonly
        moved?: ReadonlyMap<string, string> }
  returns:
    type: 'Promise<[[reference/api/plugins/CompiledNoteVersion|CompiledNoteVersion]]>'
  source: >-
    https://github.com/mia-cx/svartz/blob/711f3906a713c8b9a5a572d0f34c85e90c3bc3d1/packages/plugins/src/note-version.ts#L63
---

# compileNoteVersion

`attachments` are vault files the version may reference beyond the published ones; those it references join the
attachments its links resolve against, and are answered: the caller publishes them, at their own path or where
`moved` says. `prefix` leads every other relative URL in the output, for a page below the note's own URL: `../../`
for one two folders down. A relative link or source naming nothing `published` holds, read from the note's URL
`note.href`, shows unresolved instead. Call it after `core:index`, from `emitArtifacts`. Browser resources the
version's steps add, such as diagrams', join the build's.
