crossnote
    Preparing search index...

    Class Notebook

    Index

    Properties

    hasLoadedNotes: boolean = false
    markdownYoRenderer: MarkdownRenderer | null = null

    Optional markdown_yo WASM renderer. Used for HTML rendering when markdownParser === 'markdown_yo'.

    md: MarkdownIt
    notebookPath: URI
    notes: Notes = {}
    referenceMap: ReferenceMap = ...
    tagReferenceMap: TagReferenceMap = ...

    Global #tag index. Independent of the file system: tags are notebook-wide metadata, not phantom paths. See src/notebook/reference.ts for shape.

    Methods

    • Build markdown_yo render options from the current notebook config.

      Parameters

      • isForPreview: boolean

      Returns RenderOptions

    • Parameters

      • filePath: string
      • alreadyDeleted: boolean = false

      Returns Promise<void>

    • List every tag that has been mentioned anywhere in the notebook. Tags are case-folded, so the returned values are lowercase.

      Returns string[]

    • Parameters

      • filePath: string
      • refreshNoteRelations: boolean = false

      Returns Promise<Note | null>

    • 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.

      Parameters

      • filePath: string

      Returns Promise<string | null>

    • 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.

      Parameters

      • tag: string

      Returns Promise<Notes>

    • Parameters

      • noteFilePath: string
      • backlinkedNoteFilePath: string

      Returns Promise<Reference[]>

    • 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).

      Parameters

      • tag: string

      Returns Promise<Backlink[]>

    • Parameters

      • filePath: string
      • OptionalmarkdownOverride: string

      Returns Promise<void>

    • Process wiki link

      Parameters

      • content: string

        content is string like "Test", "test.md | Test"

      Returns { blockRef?: string; hash?: string; link: string; text: string }

    • Parameters

      • __namedParameters: RefreshNotesIfNotLoaded

      Returns Promise<Notes>

    • 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.

      Parameters

      • args: RefreshNotesArgs

      Returns Promise<Notes>

    • Parameters

      • filePath: string

      Returns Promise<void>

    • Render markdown to HTML using markdown_yo (WASM) if available, otherwise falls back to markdown-it.

      Parameters

      • markdown: string
      • Optionaloptions: { isForPreview?: boolean }

      Returns string

    • Get the absolute path of the note

      Parameters

      • filePath: string

      Returns string

    • Get the relative path of the note to the notebook directory

      Parameters

      • filePath: string

      Returns string

    • 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.

      Parameters

      • link: string

        — the file portion of the link (after processWikilink, without fragment/hash/block-id)

      • currentNoteFilePath: string

        — the notebook-relative path of the note containing this link

      Returns string

      notebook-root-relative file path