5.0.0 • Published 29 days ago

dgeni-front-matter v5.0.0

Weekly downloads
115
License
MIT
Repository
gitlab
Last release
29 days ago

Dgeni Front Matter

Process YAML Front Matter blocks from Markdown files.

Usage

const packagePath = __dirname;

/* create dgeni application */
const pkg = new Package("my-package", [require("dgeni-front-matter")]);

/* configure dgeni to process all markdown files with frontmatter */
pkg.config(function (readFilesProcessor) {
  readFilesProcessor.sourceFiles = [
    {
      include: "**/*.md",
      basePath: ".",
      fileReader: "frontMatterFileReader",
    },
  ];
});

Document properties

  • doc.docType defaults to front-matter but can be set by adding docType front matter property.
  • doctype.frontmatter is always set to true.

All properties from front matter are assigned to doc.

Given a markdown file such as:

---
foo: bar
---

lorem ipsum

The doc object would be:

{
  docType: 'front-matter',
  frontMatter: true,
  content: 'lorem ipsum',
  foo: "bar"
}

Templates

Templates for rendering documents are searched as following:

  • ${ doc.template }
  • ${ doc.id }.${ doc.docType }.template.html
  • ${ doc.id }.template.html
  • ${ doc.docType }.template.html
5.0.0

29 days ago

4.1.0

9 months ago

4.0.0

2 years ago

3.0.0

3 years ago

2.0.3

3 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago