Class ContentHandler<TParsed>

Type Parameters

  • TParsed = any

Hierarchy

Constructors

  • Type Parameters

    • TParsed = any

    Parameters

    • name: string

      The plugin name.

    • globs: string[]

      A list of globs it handles.

    Returns ContentHandler<TParsed>

Properties

cache: any

The cache should be an object and it should not be re-assigned to (i.e. do no do this.cache = ... after constructing) or the server will loose track of it and will not write/load it from disk.

cacheEnabled?: boolean = true
globs: string[]
name: string

Methods

  • Should do any final compilation steps. The server will call it as needed. Some files might not need compilation, it is not required.

    Parameters

    • entry: InternalContentEntry<TParsed>

    Returns Promise<ContentEntry<TParsed>>

  • Parameters

    • metadata: Omit<MakeOptional<ContentMetadata, "publish" | "tags">, "extra"> & Record<string, any>

    Returns ContentMetadata

  • Parameters

    • entry: InternalContentEntry<TParsed>

    Returns Promise<any>

  • Should do the initial entry parsing and partially "resolve" any relative paths and wiki/obsidian like paths.

    See ContentEntry for what it needs to return.

    It should also keep a reference to the parsed tree if there is any, such that it can be changed to resolve/unresolve links and get recompiled without reparsing it.

    Parameters

    • filepath: string
    • Optional stats: Stats

    Returns Promise<ContentEntry<TParsed>>

  • Given an entry and a link map (Record<link, {id, permalink}>), should return a list of ids it could resolve if it is a type of file that can resolve them.

    The default implementation returns an empty array.

    Parameters

    • entry: InternalContentEntry<TParsed>
    • linkMap: LinkMapperResolve

    Returns Promise<string[]>

  • Given an entry and a link map (Record<permalink, {id, link}>), should return a list of ids it could unresolve (change back from permalinks to link, the original resolved path) if it is a type of file that can resolve links.

    The default implementation returns an empty array.

    Parameters

    • entry: InternalContentEntry<TParsed>
    • linkMap: LinkMapperUnResolve

    Returns Promise<string[]>

Generated using TypeDoc