init
This commit is contained in:
16
node_modules/remark-frontmatter/lib/index.d.ts
generated
vendored
Normal file
16
node_modules/remark-frontmatter/lib/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Add support for frontmatter.
|
||||
*
|
||||
* ###### Notes
|
||||
*
|
||||
* Doesn’t parse the data inside them: create your own plugin to do that.
|
||||
*
|
||||
* @param {Options | null | undefined} [options='yaml']
|
||||
* Configuration (default: `'yaml'`).
|
||||
* @returns {undefined}
|
||||
* Nothing.
|
||||
*/
|
||||
export default function remarkFrontmatter(options?: Options | null | undefined): undefined;
|
||||
export type Root = import('mdast').Root;
|
||||
export type Options = import('micromark-extension-frontmatter').Options;
|
||||
export type Processor = import('unified').Processor<Root>;
|
||||
48
node_modules/remark-frontmatter/lib/index.js
generated
vendored
Normal file
48
node_modules/remark-frontmatter/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/// <reference types="remark-parse" />
|
||||
/// <reference types="remark-stringify" />
|
||||
|
||||
/**
|
||||
* @typedef {import('mdast').Root} Root
|
||||
* @typedef {import('micromark-extension-frontmatter').Options} Options
|
||||
* @typedef {import('unified').Processor<Root>} Processor
|
||||
*/
|
||||
|
||||
import {
|
||||
frontmatterFromMarkdown,
|
||||
frontmatterToMarkdown
|
||||
} from 'mdast-util-frontmatter'
|
||||
import {frontmatter} from 'micromark-extension-frontmatter'
|
||||
|
||||
/** @type {Options} */
|
||||
const emptyOptions = 'yaml'
|
||||
|
||||
/**
|
||||
* Add support for frontmatter.
|
||||
*
|
||||
* ###### Notes
|
||||
*
|
||||
* Doesn’t parse the data inside them: create your own plugin to do that.
|
||||
*
|
||||
* @param {Options | null | undefined} [options='yaml']
|
||||
* Configuration (default: `'yaml'`).
|
||||
* @returns {undefined}
|
||||
* Nothing.
|
||||
*/
|
||||
export default function remarkFrontmatter(options) {
|
||||
// @ts-expect-error: TS is wrong about `this`.
|
||||
// eslint-disable-next-line unicorn/no-this-assignment
|
||||
const self = /** @type {Processor} */ (this)
|
||||
const settings = options || emptyOptions
|
||||
const data = self.data()
|
||||
|
||||
const micromarkExtensions =
|
||||
data.micromarkExtensions || (data.micromarkExtensions = [])
|
||||
const fromMarkdownExtensions =
|
||||
data.fromMarkdownExtensions || (data.fromMarkdownExtensions = [])
|
||||
const toMarkdownExtensions =
|
||||
data.toMarkdownExtensions || (data.toMarkdownExtensions = [])
|
||||
|
||||
micromarkExtensions.push(frontmatter(settings))
|
||||
fromMarkdownExtensions.push(frontmatterFromMarkdown(settings))
|
||||
toMarkdownExtensions.push(frontmatterToMarkdown(settings))
|
||||
}
|
||||
Reference in New Issue
Block a user