GitXplorerGitXplorer
e

front-matter-loader

public
12 stars
1 forks
17 issues

Commits

List of commits on branch master.
Unverified
40ad77f2cc76bf3fc2cacff0b9007590a86152b6

Update dependency webpack to v5.94.0

rrenovate[bot] committed a month ago
Unverified
5206756f7008aba351a8c06ab649e84eaccc9733

Update dependency webpack to v5.93.0

rrenovate[bot] committed 2 months ago
Unverified
85d5d0cac9441f00e4d133562b7fd7f9d1b4ecc5

Update dependency webpack to v5.92.1

rrenovate[bot] committed 3 months ago
Unverified
bf5168405febd0020154b57eb686f387e66c7a36

Update dependency webpack to v5.92.0

rrenovate[bot] committed 3 months ago
Unverified
a3a7dfa67143a998d01a6f530a6b79c53d7255b3

Update dependency webpack to v5.91.0

rrenovate[bot] committed 6 months ago
Unverified
fba21ffbecaa54d92f4f6d2829349fc1ba186113

Update dependency webpack to v5.90.3

rrenovate[bot] committed 7 months ago

README

The README file for this repository.

front-matter-loader

npm version

webpack loader to extract frontmatter using jxson/front-matter

Installation

npm install front-matter-loader

Usage

Given a file with frontmatter, e.g. example.md:

---
title: Example
description: This is an example
---

Here is some example content

The frontmatter can be extracted like this (using json-loader):

var exampleFrontmatter = require('json-loader!front-matter-loader!./example.md');

console.log(exampleFrontmatter.attributes.title);
// => 'Example'
console.log(exampleFrontmatter.attributes.description);
// => 'This is an example'
console.log(exampleFrontmatter.body);
// => 'Here is some example content'

To extract only the frontmatter attributes of the target file, use the onlyAttributes query parameter:

var exampleAttributes = require('json-loader!front-matter-loader?onlyAttributes!./example.md');
console.log(exampleAttributes.title);
// => 'Example'
console.log(exampleAttributes.description);
// => 'This is an example'

To extract only the body content of the target file, use the onlyBody query parameter:

var exampleContent = require('raw-loader!front-matter-loader?onlyBody!./example.md');

For a complete example using a webpack config, see example/.