0.4.5 • Published 2 years ago

@lackadaisical/defaults-generator v0.4.5

Weekly downloads
63
License
GPL-3.0-or-later
Repository
-
Last release
2 years ago

@lackadaisical/defaults-generator

A module for generating pandoc defaults files from Markdown YAML frontmatter.

Installation and Usage

npm:

npm install @lackadaisical/defaults-generator

Yarn:

yarn add @lackadaisical/defaults-generator

makeDefaultsFile

export default function makeDefaultsFile(
  frontmatter: Record<string, unknown>,
  {
    additionalConfig?: Record<string, unknown>
    projectSettings?: Record<string, unknown>
    outputFile?: string
    writer?: string
  }
): defaultsFile {

Where:

frontmatter, additionalConfig, and projectSettings are the configurations that you want to generate a defaults file from.

If duplicate keys exist, precedence is projectSettings < additionalConfig < frontmatter.

Optional values passed to the function will override output-file and writer keys in the input object.

Note: If you don't provide a writer, and and do provide an output-file the module will attempt to pick an appropriate writer based on pandoc's logic.

Validation

Defaults file keys are validated against a built-in schema.

If a key does not exist in the schema, it will be placed under the variables: key.

If a key exists in the schema its type (or value, depending on the key) must match those specified in the schema, else an error will be thrown. This utility only generates valid defaults files.

0.4.5

2 years ago

0.4.4

2 years ago

0.4.3

2 years ago

0.4.1

3 years ago

0.4.2

3 years ago

0.4.0

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.2.7

3 years ago

0.2.6

3 years ago

0.2.5

3 years ago

0.2.3

3 years ago

0.2.4

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.2.2

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago