Class MarkdownHandler<T>

Type Parameters

  • T extends ContentFile = ContentFile

Hierarchy

Constructors

  • Type Parameters

    • T extends ContentFile = ContentFile

    Parameters

    • __namedParameters: {
          cache?: boolean;
          globs: string[];
          parsableProperties?: string[];
          permalink?: string | ((name: string, ext: string, metadata: ContentMetadata) => string);
          resolvableProperties?: Record<string, true | LinkTransformer>;
          stripExtensions?: string[];
          type?: string;
      }
      • Optional cache?: boolean

        Whether to enable the cache.

      • globs: string[]
      • Optional parsableProperties?: string[]

        Whether to enable the cache.

      • Optional permalink?: string | ((name: string, ext: string, metadata: ContentMetadata) => string)

        The permalink base, e.g. /post/, in which case the permalinks will look like /post/slug or a function that returns the permalink.

      • Optional resolvableProperties?: Record<string, true | LinkTransformer>

        A record of additional properties that can be resolved. The default is {thumbnail:true} to enable thumbnail paths to be resolved.

        Properties can also be custom functions that returns the resolved path and optionally properties to set on the resource. See InternalContentEntry.properties

      • Optional stripExtensions?: string[]

        A list of extensions to strip from the filename before creating the slug. The default is [md].

      • Optional type?: string

        The default type for posts processed by this plugin. The default is post. A file can change this by setting a type property in it's yaml header.

        For example, a page could set it's type to page and later you can filter these out when querying the server.

    Returns MarkdownHandler<T>

Properties

cache: {
    content: Record<string, any>;
    links: Record<string, string>;
} = ...

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.

Type declaration

  • content: Record<string, any>
  • links: Record<string, string>
cacheEnabled?: boolean = true
globs: string[]
name: string
type: string = "post"

Methods

  • Parameters

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

    Returns ContentMetadata

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

  • 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<T>
    • 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<T>
    • linkMap: LinkMapperUnResolve

    Returns Promise<string[]>

Generated using TypeDoc