Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FrontMatterInjector

Injects Front Matter data into the contents of a file by analyzing where a data key is found in content between curly brackets.

Hierarchy

  • FrontMatterInjector

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

Private contents

contents: string

the contents of the file where to look for insert commanda.

Private data

the full Front Matter data of the file to be inserted.

Methods

inject

  • inject(): string

Private injectDataValues

  • injectDataValues(identifier: string, value: string | Object | Array<any>): void
  • Injects data values into content by matching the regexp formed by each key of data between tcurly brackets.

    Parameters

    • identifier: string

      the key of the data to look for.

    • value: string | Object | Array<any>

      the value to be injected.

    Returns void

Private stingify

  • stingify(value: string | Object | Array<unknown>, identifier: string): string
  • Converts non string Front Matter data values to strings with JSON stringify.

    Parameters

    • value: string | Object | Array<unknown>

      the value to check and eventually convert.

    • identifier: string

      the key of the data.

    Returns string

    the value as a string.