Optional markdown_yo WASM renderer.
Used for HTML rendering when markdownParser === 'markdown_yo'.
Whether user-provided preview scripts may run in the preview webview:
<script src> tags in .crossnote/head.html and @import "*.js"
file imports. Defaults to false, which keeps both channels inert.
SECURITY: deliberately NOT part of NotebookConfig — config values
are merged from the repository's .crossnote/config.js, which is
untrusted content. Only the host application may set this flag
(e.g. from a user-scoped, application-scope setting); repository
files must never be able to turn it on.
Global #tag index. Independent of the file system: tags are
notebook-wide metadata, not phantom paths. See
src/notebook/reference.ts for shape.
Extra absolute directories that <script src> tags in head.html may
resolve into when previewScriptsEnabled is on, in addition to the
notebook directory. Hosts use this to let the global config
directory's head.html load the scripts sitting next to it — those
files are user-owned (like the global head.html itself), but live
outside every notebook. Defaults to [].
SECURITY: deliberately NOT part of NotebookConfig — config values
are merged from the repository's .crossnote/config.js, which is
untrusted content. Only the host application may name a trusted
root, and only from user-scoped settings; repository files must
never be able to point this at a directory they control. Resolution
is still containment-checked per root (realpath, symlinks included),
and the @import "*.js" channel stays notebook-directory-only.
Build markdown_yo render options from the current notebook config.
Delete a note and update the internal note relations and search index.
Note to delete.
Set to true when the caller has already removed
the file from disk (e.g. a filesystem watcher reacting to a deletion
event). In that case the file is left untouched — a replacement file
recreated at the same path (e.g. by a Git checkout) must survive —
and only the internal bookkeeping is refreshed.
List every tag that has been mentioned anywhere in the notebook. Tags are case-folded, so the returned values are lowercase.
Read a note's markdown body, lazily. Always reads from disk and
runs the same front-matter normalisation as getNote — the body
is intentionally not cached on Note, so this is the canonical
way to fetch it.
Returns null for files that aren't markdown (extension not in
markdownFileExtensions), are missing, or exceed maxNoteFileSize.
Notes that mention a given #tag, anywhere in the notebook.
Tag is matched case-insensitively.
Reads from the in-memory notes map — same rationale as
getBacklinkedNotes: re-loading each referrer from disk would be
N async hops for no win, since the index can only contain
referrers we already loaded.
Same shape as getNoteBacklinks, but for a #tag rather than a
note filepath. Each Backlink groups a referrer note with the
individual #tag references inside it (token + rendered HTML).
A markdown-it instance for rendering the sidebar TOC, with source maps
disabled. parseMD renders the TOC on every preview update, so the
instance is created lazily and reused until the live-updated markdown-it
options change.
Optional_fs: FileSystemApiOptionaloptions: ExtendedMarkdownItOptionsOptionalmarkdownOverride: stringProcess wiki link
content is string like "Test", "test.md | Test"
Incremental version of refreshNotes: instead of wiping the
indices and rebuilding from scratch, walk the workspace and only
re-process files whose on-disk mtime has advanced past the value
recorded in processedMtimes (set during the most recent full
refresh or prior incremental refresh). Newly-added files are
processed; cached entries that no longer exist on disk are
removed (their reference / tag entries cleaned up).
Designed to be cheap to call from a file-system watcher. The
directory walk still has to stat every file under dir, but the
O(N) markdown re-tokenisation is skipped for unchanged files.
Shares the refreshNotesMutex with refreshNotes so the two
can't race against each other.
Render markdown to HTML using markdown_yo (WASM) if available, otherwise falls back to markdown-it.
Optionaloptions: { isForPreview?: boolean }Get the absolute path of the note
Get the relative path of the note to the notebook directory
Resolve a wiki link file path to a notebook-root-relative path. Used by both index-time mention tracking and render-time embed resolution so both paths agree on link resolution.
— the file portion of the link (after processWikilink, without fragment/hash/block-id)
— the notebook-relative path of the note containing this link
notebook-root-relative file path
Staticinit
The notebook-relative path of the note currently being rendered. Set by MarkdownEngine.parseMD() before calling renderMarkdown(). Used by the wikilink renderer to call resolveWikilink() with the correct context.