🎉 initiate project *astro_rewrite*
This commit is contained in:
parent
ffd4d5e86c
commit
2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions
6
node_modules/micromark-extension-frontmatter/dev/index.d.ts
generated
vendored
Normal file
6
node_modules/micromark-extension-frontmatter/dev/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
export {frontmatter} from './lib/syntax.js'
|
||||
export {frontmatterHtml} from './lib/html.js'
|
||||
export type Info = import('./matters.js').Info
|
||||
export type Matter = import('./matters.js').Matter
|
||||
export type Options = import('./matters.js').Options
|
||||
export type Preset = import('./matters.js').Preset
|
||||
12
node_modules/micromark-extension-frontmatter/dev/index.js
generated
vendored
Normal file
12
node_modules/micromark-extension-frontmatter/dev/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* @typedef {import('./matters.js').Info} Info
|
||||
* @typedef {import('./matters.js').Matter} Matter
|
||||
* @typedef {import('./matters.js').Options} Options
|
||||
* @typedef {import('./matters.js').Preset} Preset
|
||||
*/
|
||||
|
||||
export {frontmatter} from './lib/syntax.js'
|
||||
export {frontmatterHtml} from './lib/html.js'
|
||||
|
||||
// Note: we don’t have an `index.d.ts` in this extension because all token
|
||||
// types are dynamic in JS
|
||||
21
node_modules/micromark-extension-frontmatter/dev/lib/html.d.ts
generated
vendored
Normal file
21
node_modules/micromark-extension-frontmatter/dev/lib/html.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/**
|
||||
* Create an extension for `micromark` to support frontmatter when serializing
|
||||
* to HTML.
|
||||
*
|
||||
* > 👉 **Note**: this makes sure nothing is generated in the output HTML for
|
||||
* > frontmatter.
|
||||
*
|
||||
* @param {Options | null | undefined} [options='yaml']
|
||||
* Configuration.
|
||||
* @returns {HtmlExtension}
|
||||
* Extension for `micromark` that can be passed in `htmlExtensions`, to
|
||||
* support frontmatter when serializing to HTML.
|
||||
*/
|
||||
export function frontmatterHtml(
|
||||
options?: Options | null | undefined
|
||||
): HtmlExtension
|
||||
export type CompileContext = import('micromark-util-types').CompileContext
|
||||
export type Handle = import('micromark-util-types').Handle
|
||||
export type HtmlExtension = import('micromark-util-types').HtmlExtension
|
||||
export type TokenType = import('micromark-util-types').TokenType
|
||||
export type Options = import('../matters.js').Options
|
||||
56
node_modules/micromark-extension-frontmatter/dev/lib/html.js
generated
vendored
Normal file
56
node_modules/micromark-extension-frontmatter/dev/lib/html.js
generated
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/**
|
||||
* @typedef {import('micromark-util-types').CompileContext} CompileContext
|
||||
* @typedef {import('micromark-util-types').Handle} Handle
|
||||
* @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension
|
||||
* @typedef {import('micromark-util-types').TokenType} TokenType
|
||||
* @typedef {import('../matters.js').Options} Options
|
||||
*/
|
||||
|
||||
import {matters} from '../matters.js'
|
||||
|
||||
/**
|
||||
* Create an extension for `micromark` to support frontmatter when serializing
|
||||
* to HTML.
|
||||
*
|
||||
* > 👉 **Note**: this makes sure nothing is generated in the output HTML for
|
||||
* > frontmatter.
|
||||
*
|
||||
* @param {Options | null | undefined} [options='yaml']
|
||||
* Configuration.
|
||||
* @returns {HtmlExtension}
|
||||
* Extension for `micromark` that can be passed in `htmlExtensions`, to
|
||||
* support frontmatter when serializing to HTML.
|
||||
*/
|
||||
export function frontmatterHtml(options) {
|
||||
const listOfMatters = matters(options)
|
||||
/** @type {HtmlExtension['enter']} */
|
||||
const enter = {}
|
||||
/** @type {HtmlExtension['exit']} */
|
||||
const exit = {}
|
||||
let index = -1
|
||||
|
||||
while (++index < listOfMatters.length) {
|
||||
const type = /** @type {TokenType} */ (listOfMatters[index].type)
|
||||
enter[type] = start
|
||||
exit[type] = end
|
||||
}
|
||||
|
||||
return {enter, exit}
|
||||
|
||||
/**
|
||||
* @this {CompileContext}
|
||||
* @type {Handle}
|
||||
*/
|
||||
function start() {
|
||||
this.buffer()
|
||||
}
|
||||
|
||||
/**
|
||||
* @this {CompileContext}
|
||||
* @type {Handle}
|
||||
*/
|
||||
function end() {
|
||||
this.resume()
|
||||
this.setData('slurpOneLineEnding', true)
|
||||
}
|
||||
}
|
||||
20
node_modules/micromark-extension-frontmatter/dev/lib/syntax.d.ts
generated
vendored
Normal file
20
node_modules/micromark-extension-frontmatter/dev/lib/syntax.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* Create an extension for `micromark` to enable frontmatter syntax.
|
||||
*
|
||||
* @param {Options | null | undefined} [options='yaml']
|
||||
* Configuration.
|
||||
* @returns {Extension}
|
||||
* Extension for `micromark` that can be passed in `extensions`, to
|
||||
* enable frontmatter syntax.
|
||||
*/
|
||||
export function frontmatter(options?: Options | null | undefined): Extension
|
||||
export type Construct = import('micromark-util-types').Construct
|
||||
export type ConstructRecord = import('micromark-util-types').ConstructRecord
|
||||
export type Extension = import('micromark-util-types').Extension
|
||||
export type State = import('micromark-util-types').State
|
||||
export type TokenType = import('micromark-util-types').TokenType
|
||||
export type TokenizeContext = import('micromark-util-types').TokenizeContext
|
||||
export type Tokenizer = import('micromark-util-types').Tokenizer
|
||||
export type Info = import('../matters.js').Info
|
||||
export type Matter = import('../matters.js').Matter
|
||||
export type Options = import('../matters.js').Options
|
||||
411
node_modules/micromark-extension-frontmatter/dev/lib/syntax.js
generated
vendored
Normal file
411
node_modules/micromark-extension-frontmatter/dev/lib/syntax.js
generated
vendored
Normal file
|
|
@ -0,0 +1,411 @@
|
|||
/**
|
||||
* @typedef {import('micromark-util-types').Construct} Construct
|
||||
* @typedef {import('micromark-util-types').ConstructRecord} ConstructRecord
|
||||
* @typedef {import('micromark-util-types').Extension} Extension
|
||||
* @typedef {import('micromark-util-types').State} State
|
||||
* @typedef {import('micromark-util-types').TokenType} TokenType
|
||||
* @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
|
||||
* @typedef {import('micromark-util-types').Tokenizer} Tokenizer
|
||||
*
|
||||
* @typedef {import('../matters.js').Info} Info
|
||||
* @typedef {import('../matters.js').Matter} Matter
|
||||
* @typedef {import('../matters.js').Options} Options
|
||||
*/
|
||||
|
||||
import {markdownLineEnding, markdownSpace} from 'micromark-util-character'
|
||||
import {codes} from 'micromark-util-symbol/codes.js'
|
||||
import {types} from 'micromark-util-symbol/types.js'
|
||||
import {matters} from '../matters.js'
|
||||
|
||||
/**
|
||||
* Create an extension for `micromark` to enable frontmatter syntax.
|
||||
*
|
||||
* @param {Options | null | undefined} [options='yaml']
|
||||
* Configuration.
|
||||
* @returns {Extension}
|
||||
* Extension for `micromark` that can be passed in `extensions`, to
|
||||
* enable frontmatter syntax.
|
||||
*/
|
||||
export function frontmatter(options) {
|
||||
const listOfMatters = matters(options)
|
||||
/** @type {ConstructRecord} */
|
||||
const flow = {}
|
||||
let index = -1
|
||||
|
||||
while (++index < listOfMatters.length) {
|
||||
const matter = listOfMatters[index]
|
||||
const code = fence(matter, 'open').charCodeAt(0)
|
||||
const construct = createConstruct(matter)
|
||||
const existing = flow[code]
|
||||
|
||||
if (Array.isArray(existing)) {
|
||||
existing.push(construct)
|
||||
} else {
|
||||
// Never a single object, always an array.
|
||||
flow[code] = [construct]
|
||||
}
|
||||
}
|
||||
|
||||
return {flow}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Matter} matter
|
||||
* @returns {Construct}
|
||||
*/
|
||||
function createConstruct(matter) {
|
||||
const anywhere = matter.anywhere
|
||||
const frontmatterType = /** @type {TokenType} */ (matter.type)
|
||||
const fenceType = /** @type {TokenType} */ (frontmatterType + 'Fence')
|
||||
const sequenceType = /** @type {TokenType} */ (fenceType + 'Sequence')
|
||||
const valueType = /** @type {TokenType} */ (frontmatterType + 'Value')
|
||||
const closingFenceConstruct = {tokenize: tokenizeClosingFence, partial: true}
|
||||
|
||||
/**
|
||||
* Fence to look for.
|
||||
*
|
||||
* @type {string}
|
||||
*/
|
||||
let buffer
|
||||
let bufferIndex = 0
|
||||
|
||||
return {tokenize: tokenizeFrontmatter, concrete: true}
|
||||
|
||||
/**
|
||||
* @this {TokenizeContext}
|
||||
* @type {Tokenizer}
|
||||
*/
|
||||
function tokenizeFrontmatter(effects, ok, nok) {
|
||||
const self = this
|
||||
|
||||
return start
|
||||
|
||||
/**
|
||||
* Start of frontmatter.
|
||||
*
|
||||
* ```markdown
|
||||
* > | ---
|
||||
* ^
|
||||
* | title: "Venus"
|
||||
* | ---
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function start(code) {
|
||||
const position = self.now()
|
||||
|
||||
if (
|
||||
// Indent not allowed.
|
||||
position.column === 1 &&
|
||||
// Normally, only allowed in first line.
|
||||
(position.line === 1 || anywhere)
|
||||
) {
|
||||
buffer = fence(matter, 'open')
|
||||
bufferIndex = 0
|
||||
|
||||
if (code === buffer.charCodeAt(bufferIndex)) {
|
||||
effects.enter(frontmatterType)
|
||||
effects.enter(fenceType)
|
||||
effects.enter(sequenceType)
|
||||
return openSequence(code)
|
||||
}
|
||||
}
|
||||
|
||||
return nok(code)
|
||||
}
|
||||
|
||||
/**
|
||||
* In open sequence.
|
||||
*
|
||||
* ```markdown
|
||||
* > | ---
|
||||
* ^
|
||||
* | title: "Venus"
|
||||
* | ---
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function openSequence(code) {
|
||||
if (bufferIndex === buffer.length) {
|
||||
effects.exit(sequenceType)
|
||||
|
||||
if (markdownSpace(code)) {
|
||||
effects.enter(types.whitespace)
|
||||
return openSequenceWhitespace(code)
|
||||
}
|
||||
|
||||
return openAfter(code)
|
||||
}
|
||||
|
||||
if (code === buffer.charCodeAt(bufferIndex++)) {
|
||||
effects.consume(code)
|
||||
return openSequence
|
||||
}
|
||||
|
||||
return nok(code)
|
||||
}
|
||||
|
||||
/**
|
||||
* In whitespace after open sequence.
|
||||
*
|
||||
* ```markdown
|
||||
* > | ---␠
|
||||
* ^
|
||||
* | title: "Venus"
|
||||
* | ---
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function openSequenceWhitespace(code) {
|
||||
if (markdownSpace(code)) {
|
||||
effects.consume(code)
|
||||
return openSequenceWhitespace
|
||||
}
|
||||
|
||||
effects.exit(types.whitespace)
|
||||
return openAfter(code)
|
||||
}
|
||||
|
||||
/**
|
||||
* After open sequence.
|
||||
*
|
||||
* ```markdown
|
||||
* > | ---
|
||||
* ^
|
||||
* | title: "Venus"
|
||||
* | ---
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function openAfter(code) {
|
||||
if (markdownLineEnding(code)) {
|
||||
effects.exit(fenceType)
|
||||
effects.enter(types.lineEnding)
|
||||
effects.consume(code)
|
||||
effects.exit(types.lineEnding)
|
||||
// Get ready for closing fence.
|
||||
buffer = fence(matter, 'close')
|
||||
bufferIndex = 0
|
||||
return effects.attempt(closingFenceConstruct, after, contentStart)
|
||||
}
|
||||
|
||||
// EOF is not okay.
|
||||
return nok(code)
|
||||
}
|
||||
|
||||
/**
|
||||
* Start of content chunk.
|
||||
*
|
||||
* ```markdown
|
||||
* | ---
|
||||
* > | title: "Venus"
|
||||
* ^
|
||||
* | ---
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function contentStart(code) {
|
||||
if (code === codes.eof || markdownLineEnding(code)) {
|
||||
return contentEnd(code)
|
||||
}
|
||||
|
||||
effects.enter(valueType)
|
||||
return contentInside(code)
|
||||
}
|
||||
|
||||
/**
|
||||
* In content chunk.
|
||||
*
|
||||
* ```markdown
|
||||
* | ---
|
||||
* > | title: "Venus"
|
||||
* ^
|
||||
* | ---
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function contentInside(code) {
|
||||
if (code === codes.eof || markdownLineEnding(code)) {
|
||||
effects.exit(valueType)
|
||||
return contentEnd(code)
|
||||
}
|
||||
|
||||
effects.consume(code)
|
||||
return contentInside
|
||||
}
|
||||
|
||||
/**
|
||||
* End of content chunk.
|
||||
*
|
||||
* ```markdown
|
||||
* | ---
|
||||
* > | title: "Venus"
|
||||
* ^
|
||||
* | ---
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function contentEnd(code) {
|
||||
// Require a closing fence.
|
||||
if (code === codes.eof) {
|
||||
return nok(code)
|
||||
}
|
||||
|
||||
// Can only be an eol.
|
||||
effects.enter(types.lineEnding)
|
||||
effects.consume(code)
|
||||
effects.exit(types.lineEnding)
|
||||
return effects.attempt(closingFenceConstruct, after, contentStart)
|
||||
}
|
||||
|
||||
/**
|
||||
* After frontmatter.
|
||||
*
|
||||
* ```markdown
|
||||
* | ---
|
||||
* | title: "Venus"
|
||||
* > | ---
|
||||
* ^
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function after(code) {
|
||||
// `code` must be eol/eof.
|
||||
effects.exit(frontmatterType)
|
||||
return ok(code)
|
||||
}
|
||||
}
|
||||
|
||||
/** @type {Tokenizer} */
|
||||
function tokenizeClosingFence(effects, ok, nok) {
|
||||
let bufferIndex = 0
|
||||
|
||||
return closeStart
|
||||
|
||||
/**
|
||||
* Start of close sequence.
|
||||
*
|
||||
* ```markdown
|
||||
* | ---
|
||||
* | title: "Venus"
|
||||
* > | ---
|
||||
* ^
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function closeStart(code) {
|
||||
if (code === buffer.charCodeAt(bufferIndex)) {
|
||||
effects.enter(fenceType)
|
||||
effects.enter(sequenceType)
|
||||
return closeSequence(code)
|
||||
}
|
||||
|
||||
return nok(code)
|
||||
}
|
||||
|
||||
/**
|
||||
* In close sequence.
|
||||
*
|
||||
* ```markdown
|
||||
* | ---
|
||||
* | title: "Venus"
|
||||
* > | ---
|
||||
* ^
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function closeSequence(code) {
|
||||
if (bufferIndex === buffer.length) {
|
||||
effects.exit(sequenceType)
|
||||
|
||||
if (markdownSpace(code)) {
|
||||
effects.enter(types.whitespace)
|
||||
return closeSequenceWhitespace(code)
|
||||
}
|
||||
|
||||
return closeAfter(code)
|
||||
}
|
||||
|
||||
if (code === buffer.charCodeAt(bufferIndex++)) {
|
||||
effects.consume(code)
|
||||
return closeSequence
|
||||
}
|
||||
|
||||
return nok(code)
|
||||
}
|
||||
|
||||
/**
|
||||
* In whitespace after close sequence.
|
||||
*
|
||||
* ```markdown
|
||||
* > | ---
|
||||
* | title: "Venus"
|
||||
* | ---␠
|
||||
* ^
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function closeSequenceWhitespace(code) {
|
||||
if (markdownSpace(code)) {
|
||||
effects.consume(code)
|
||||
return closeSequenceWhitespace
|
||||
}
|
||||
|
||||
effects.exit(types.whitespace)
|
||||
return closeAfter(code)
|
||||
}
|
||||
|
||||
/**
|
||||
* After close sequence.
|
||||
*
|
||||
* ```markdown
|
||||
* | ---
|
||||
* | title: "Venus"
|
||||
* > | ---
|
||||
* ^
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function closeAfter(code) {
|
||||
if (code === codes.eof || markdownLineEnding(code)) {
|
||||
effects.exit(fenceType)
|
||||
return ok(code)
|
||||
}
|
||||
|
||||
return nok(code)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Matter} matter
|
||||
* @param {'open' | 'close'} prop
|
||||
* @returns {string}
|
||||
*/
|
||||
function fence(matter, prop) {
|
||||
return matter.marker
|
||||
? pick(matter.marker, prop).repeat(3)
|
||||
: // @ts-expect-error: They’re mutually exclusive.
|
||||
pick(matter.fence, prop)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Info | string} schema
|
||||
* @param {'open' | 'close'} prop
|
||||
* @returns {string}
|
||||
*/
|
||||
function pick(schema, prop) {
|
||||
return typeof schema === 'string' ? schema : schema[prop]
|
||||
}
|
||||
97
node_modules/micromark-extension-frontmatter/dev/matters.d.ts
generated
vendored
Normal file
97
node_modules/micromark-extension-frontmatter/dev/matters.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
/**
|
||||
* Simplify one or more options.
|
||||
*
|
||||
* @param {Options | null | undefined} [options='yaml']
|
||||
* Configuration.
|
||||
* @returns {Array<Matter>}
|
||||
* List of matters.
|
||||
*/
|
||||
export function matters(options?: Options | null | undefined): Array<Matter>
|
||||
/**
|
||||
* Known name of a frontmatter style.
|
||||
*/
|
||||
export type Preset = 'toml' | 'yaml'
|
||||
/**
|
||||
* Sequence.
|
||||
*
|
||||
* Depending on how this structure is used, it reflects a marker or a fence.
|
||||
*/
|
||||
export type Info = {
|
||||
/**
|
||||
* Opening.
|
||||
*/
|
||||
open: string
|
||||
/**
|
||||
* Closing.
|
||||
*/
|
||||
close: string
|
||||
}
|
||||
/**
|
||||
* Fields describing a kind of matter.
|
||||
*/
|
||||
export type MatterProps = {
|
||||
/**
|
||||
* Node type to tokenize as.
|
||||
*/
|
||||
type: string
|
||||
/**
|
||||
* Whether matter can be found anywhere in the document, normally, only matter
|
||||
* at the start of the document is recognized.
|
||||
*
|
||||
* > 👉 **Note**: using this is a terrible idea.
|
||||
* > It’s called frontmatter, not matter-in-the-middle or so.
|
||||
* > This makes your markdown less portable.
|
||||
*/
|
||||
anywhere?: boolean | null | undefined
|
||||
}
|
||||
/**
|
||||
* Marker configuration.
|
||||
*/
|
||||
export type MarkerProps = {
|
||||
/**
|
||||
* Character repeated 3 times, used as complete fences.
|
||||
*
|
||||
* For example the character `'-'` will result in `'---'` being used as the
|
||||
* fence
|
||||
* Pass `open` and `close` to specify different characters for opening and
|
||||
* closing fences.
|
||||
*/
|
||||
marker: Info | string
|
||||
/**
|
||||
* If `marker` is set, `fence` must not be set.
|
||||
*/
|
||||
fence?: never
|
||||
}
|
||||
/**
|
||||
* Fence configuration.
|
||||
*/
|
||||
export type FenceProps = {
|
||||
/**
|
||||
* Complete fences.
|
||||
*
|
||||
* This can be used when fences contain different characters or lengths
|
||||
* other than 3.
|
||||
* Pass `open` and `close` to interface to specify different characters for opening and
|
||||
* closing fences.
|
||||
*/
|
||||
fence: Info | string
|
||||
/**
|
||||
* If `fence` is set, `marker` must not be set.
|
||||
*/
|
||||
marker?: never
|
||||
}
|
||||
/**
|
||||
* Fields describing a kind of matter.
|
||||
*
|
||||
* > 👉 **Note**: using `anywhere` is a terrible idea.
|
||||
* > It’s called frontmatter, not matter-in-the-middle or so.
|
||||
* > This makes your markdown less portable.
|
||||
*
|
||||
* > 👉 **Note**: `marker` and `fence` are mutually exclusive.
|
||||
* > If `marker` is set, `fence` must not be set, and vice versa.
|
||||
*/
|
||||
export type Matter = (MatterProps & FenceProps) | (MatterProps & MarkerProps)
|
||||
/**
|
||||
* Configuration.
|
||||
*/
|
||||
export type Options = Matter | Preset | Array<Matter | Preset>
|
||||
126
node_modules/micromark-extension-frontmatter/dev/matters.js
generated
vendored
Normal file
126
node_modules/micromark-extension-frontmatter/dev/matters.js
generated
vendored
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
/**
|
||||
* @typedef {'toml' | 'yaml'} Preset
|
||||
* Known name of a frontmatter style.
|
||||
*
|
||||
* @typedef Info
|
||||
* Sequence.
|
||||
*
|
||||
* Depending on how this structure is used, it reflects a marker or a fence.
|
||||
* @property {string} open
|
||||
* Opening.
|
||||
* @property {string} close
|
||||
* Closing.
|
||||
*
|
||||
* @typedef MatterProps
|
||||
* Fields describing a kind of matter.
|
||||
* @property {string} type
|
||||
* Node type to tokenize as.
|
||||
* @property {boolean | null | undefined} [anywhere=false]
|
||||
* Whether matter can be found anywhere in the document, normally, only matter
|
||||
* at the start of the document is recognized.
|
||||
*
|
||||
* > 👉 **Note**: using this is a terrible idea.
|
||||
* > It’s called frontmatter, not matter-in-the-middle or so.
|
||||
* > This makes your markdown less portable.
|
||||
*
|
||||
* @typedef MarkerProps
|
||||
* Marker configuration.
|
||||
* @property {Info | string} marker
|
||||
* Character repeated 3 times, used as complete fences.
|
||||
*
|
||||
* For example the character `'-'` will result in `'---'` being used as the
|
||||
* fence
|
||||
* Pass `open` and `close` to specify different characters for opening and
|
||||
* closing fences.
|
||||
* @property {never} [fence]
|
||||
* If `marker` is set, `fence` must not be set.
|
||||
*
|
||||
* @typedef FenceProps
|
||||
* Fence configuration.
|
||||
* @property {Info | string} fence
|
||||
* Complete fences.
|
||||
*
|
||||
* This can be used when fences contain different characters or lengths
|
||||
* other than 3.
|
||||
* Pass `open` and `close` to interface to specify different characters for opening and
|
||||
* closing fences.
|
||||
* @property {never} [marker]
|
||||
* If `fence` is set, `marker` must not be set.
|
||||
*
|
||||
* @typedef {(MatterProps & FenceProps) | (MatterProps & MarkerProps)} Matter
|
||||
* Fields describing a kind of matter.
|
||||
*
|
||||
* > 👉 **Note**: using `anywhere` is a terrible idea.
|
||||
* > It’s called frontmatter, not matter-in-the-middle or so.
|
||||
* > This makes your markdown less portable.
|
||||
*
|
||||
* > 👉 **Note**: `marker` and `fence` are mutually exclusive.
|
||||
* > If `marker` is set, `fence` must not be set, and vice versa.
|
||||
*
|
||||
* @typedef {Matter | Preset | Array<Matter | Preset>} Options
|
||||
* Configuration.
|
||||
*/
|
||||
|
||||
import {fault} from 'fault'
|
||||
|
||||
const own = {}.hasOwnProperty
|
||||
const markers = {yaml: '-', toml: '+'}
|
||||
|
||||
/**
|
||||
* Simplify one or more options.
|
||||
*
|
||||
* @param {Options | null | undefined} [options='yaml']
|
||||
* Configuration.
|
||||
* @returns {Array<Matter>}
|
||||
* List of matters.
|
||||
*/
|
||||
export function matters(options) {
|
||||
/** @type {Array<Matter>} */
|
||||
const result = []
|
||||
let index = -1
|
||||
|
||||
/** @type {Array<Matter | Preset>} */
|
||||
const presetsOrMatters = Array.isArray(options)
|
||||
? options
|
||||
: options
|
||||
? [options]
|
||||
: ['yaml']
|
||||
|
||||
while (++index < presetsOrMatters.length) {
|
||||
result[index] = matter(presetsOrMatters[index])
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Simplify an option.
|
||||
*
|
||||
* @param {Matter | Preset} option
|
||||
* Configuration.
|
||||
* @returns {Matter}
|
||||
* Matters.
|
||||
*/
|
||||
function matter(option) {
|
||||
let result = option
|
||||
|
||||
if (typeof result === 'string') {
|
||||
if (!own.call(markers, result)) {
|
||||
throw fault('Missing matter definition for `%s`', result)
|
||||
}
|
||||
|
||||
result = {type: result, marker: markers[result]}
|
||||
} else if (typeof result !== 'object') {
|
||||
throw fault('Expected matter to be an object, not `%j`', result)
|
||||
}
|
||||
|
||||
if (!own.call(result, 'type')) {
|
||||
throw fault('Missing `type` in matter `%j`', result)
|
||||
}
|
||||
|
||||
if (!own.call(result, 'fence') && !own.call(result, 'marker')) {
|
||||
throw fault('Missing `marker` or `fence` in matter `%j`', result)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
6
node_modules/micromark-extension-frontmatter/index.d.ts
generated
vendored
Normal file
6
node_modules/micromark-extension-frontmatter/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
export {frontmatter} from './lib/syntax.js'
|
||||
export {frontmatterHtml} from './lib/html.js'
|
||||
export type Info = import('./matters.js').Info
|
||||
export type Matter = import('./matters.js').Matter
|
||||
export type Options = import('./matters.js').Options
|
||||
export type Preset = import('./matters.js').Preset
|
||||
12
node_modules/micromark-extension-frontmatter/index.js
generated
vendored
Normal file
12
node_modules/micromark-extension-frontmatter/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* @typedef {import('./matters.js').Info} Info
|
||||
* @typedef {import('./matters.js').Matter} Matter
|
||||
* @typedef {import('./matters.js').Options} Options
|
||||
* @typedef {import('./matters.js').Preset} Preset
|
||||
*/
|
||||
|
||||
export {frontmatter} from './lib/syntax.js'
|
||||
export {frontmatterHtml} from './lib/html.js'
|
||||
|
||||
// Note: we don’t have an `index.d.ts` in this extension because all token
|
||||
// types are dynamic in JS
|
||||
21
node_modules/micromark-extension-frontmatter/lib/html.d.ts
generated
vendored
Normal file
21
node_modules/micromark-extension-frontmatter/lib/html.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/**
|
||||
* Create an extension for `micromark` to support frontmatter when serializing
|
||||
* to HTML.
|
||||
*
|
||||
* > 👉 **Note**: this makes sure nothing is generated in the output HTML for
|
||||
* > frontmatter.
|
||||
*
|
||||
* @param {Options | null | undefined} [options='yaml']
|
||||
* Configuration.
|
||||
* @returns {HtmlExtension}
|
||||
* Extension for `micromark` that can be passed in `htmlExtensions`, to
|
||||
* support frontmatter when serializing to HTML.
|
||||
*/
|
||||
export function frontmatterHtml(
|
||||
options?: Options | null | undefined
|
||||
): HtmlExtension
|
||||
export type CompileContext = import('micromark-util-types').CompileContext
|
||||
export type Handle = import('micromark-util-types').Handle
|
||||
export type HtmlExtension = import('micromark-util-types').HtmlExtension
|
||||
export type TokenType = import('micromark-util-types').TokenType
|
||||
export type Options = import('../matters.js').Options
|
||||
57
node_modules/micromark-extension-frontmatter/lib/html.js
generated
vendored
Normal file
57
node_modules/micromark-extension-frontmatter/lib/html.js
generated
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* @typedef {import('micromark-util-types').CompileContext} CompileContext
|
||||
* @typedef {import('micromark-util-types').Handle} Handle
|
||||
* @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension
|
||||
* @typedef {import('micromark-util-types').TokenType} TokenType
|
||||
* @typedef {import('../matters.js').Options} Options
|
||||
*/
|
||||
|
||||
import {matters} from '../matters.js'
|
||||
|
||||
/**
|
||||
* Create an extension for `micromark` to support frontmatter when serializing
|
||||
* to HTML.
|
||||
*
|
||||
* > 👉 **Note**: this makes sure nothing is generated in the output HTML for
|
||||
* > frontmatter.
|
||||
*
|
||||
* @param {Options | null | undefined} [options='yaml']
|
||||
* Configuration.
|
||||
* @returns {HtmlExtension}
|
||||
* Extension for `micromark` that can be passed in `htmlExtensions`, to
|
||||
* support frontmatter when serializing to HTML.
|
||||
*/
|
||||
export function frontmatterHtml(options) {
|
||||
const listOfMatters = matters(options)
|
||||
/** @type {HtmlExtension['enter']} */
|
||||
const enter = {}
|
||||
/** @type {HtmlExtension['exit']} */
|
||||
const exit = {}
|
||||
let index = -1
|
||||
while (++index < listOfMatters.length) {
|
||||
const type = /** @type {TokenType} */ listOfMatters[index].type
|
||||
enter[type] = start
|
||||
exit[type] = end
|
||||
}
|
||||
return {
|
||||
enter,
|
||||
exit
|
||||
}
|
||||
|
||||
/**
|
||||
* @this {CompileContext}
|
||||
* @type {Handle}
|
||||
*/
|
||||
function start() {
|
||||
this.buffer()
|
||||
}
|
||||
|
||||
/**
|
||||
* @this {CompileContext}
|
||||
* @type {Handle}
|
||||
*/
|
||||
function end() {
|
||||
this.resume()
|
||||
this.setData('slurpOneLineEnding', true)
|
||||
}
|
||||
}
|
||||
20
node_modules/micromark-extension-frontmatter/lib/syntax.d.ts
generated
vendored
Normal file
20
node_modules/micromark-extension-frontmatter/lib/syntax.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* Create an extension for `micromark` to enable frontmatter syntax.
|
||||
*
|
||||
* @param {Options | null | undefined} [options='yaml']
|
||||
* Configuration.
|
||||
* @returns {Extension}
|
||||
* Extension for `micromark` that can be passed in `extensions`, to
|
||||
* enable frontmatter syntax.
|
||||
*/
|
||||
export function frontmatter(options?: Options | null | undefined): Extension
|
||||
export type Construct = import('micromark-util-types').Construct
|
||||
export type ConstructRecord = import('micromark-util-types').ConstructRecord
|
||||
export type Extension = import('micromark-util-types').Extension
|
||||
export type State = import('micromark-util-types').State
|
||||
export type TokenType = import('micromark-util-types').TokenType
|
||||
export type TokenizeContext = import('micromark-util-types').TokenizeContext
|
||||
export type Tokenizer = import('micromark-util-types').Tokenizer
|
||||
export type Info = import('../matters.js').Info
|
||||
export type Matter = import('../matters.js').Matter
|
||||
export type Options = import('../matters.js').Options
|
||||
394
node_modules/micromark-extension-frontmatter/lib/syntax.js
generated
vendored
Normal file
394
node_modules/micromark-extension-frontmatter/lib/syntax.js
generated
vendored
Normal file
|
|
@ -0,0 +1,394 @@
|
|||
/**
|
||||
* @typedef {import('micromark-util-types').Construct} Construct
|
||||
* @typedef {import('micromark-util-types').ConstructRecord} ConstructRecord
|
||||
* @typedef {import('micromark-util-types').Extension} Extension
|
||||
* @typedef {import('micromark-util-types').State} State
|
||||
* @typedef {import('micromark-util-types').TokenType} TokenType
|
||||
* @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
|
||||
* @typedef {import('micromark-util-types').Tokenizer} Tokenizer
|
||||
*
|
||||
* @typedef {import('../matters.js').Info} Info
|
||||
* @typedef {import('../matters.js').Matter} Matter
|
||||
* @typedef {import('../matters.js').Options} Options
|
||||
*/
|
||||
|
||||
import {markdownLineEnding, markdownSpace} from 'micromark-util-character'
|
||||
import {matters} from '../matters.js'
|
||||
|
||||
/**
|
||||
* Create an extension for `micromark` to enable frontmatter syntax.
|
||||
*
|
||||
* @param {Options | null | undefined} [options='yaml']
|
||||
* Configuration.
|
||||
* @returns {Extension}
|
||||
* Extension for `micromark` that can be passed in `extensions`, to
|
||||
* enable frontmatter syntax.
|
||||
*/
|
||||
export function frontmatter(options) {
|
||||
const listOfMatters = matters(options)
|
||||
/** @type {ConstructRecord} */
|
||||
const flow = {}
|
||||
let index = -1
|
||||
while (++index < listOfMatters.length) {
|
||||
const matter = listOfMatters[index]
|
||||
const code = fence(matter, 'open').charCodeAt(0)
|
||||
const construct = createConstruct(matter)
|
||||
const existing = flow[code]
|
||||
if (Array.isArray(existing)) {
|
||||
existing.push(construct)
|
||||
} else {
|
||||
// Never a single object, always an array.
|
||||
flow[code] = [construct]
|
||||
}
|
||||
}
|
||||
return {
|
||||
flow
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Matter} matter
|
||||
* @returns {Construct}
|
||||
*/
|
||||
function createConstruct(matter) {
|
||||
const anywhere = matter.anywhere
|
||||
const frontmatterType = /** @type {TokenType} */ matter.type
|
||||
const fenceType = /** @type {TokenType} */ frontmatterType + 'Fence'
|
||||
const sequenceType = /** @type {TokenType} */ fenceType + 'Sequence'
|
||||
const valueType = /** @type {TokenType} */ frontmatterType + 'Value'
|
||||
const closingFenceConstruct = {
|
||||
tokenize: tokenizeClosingFence,
|
||||
partial: true
|
||||
}
|
||||
|
||||
/**
|
||||
* Fence to look for.
|
||||
*
|
||||
* @type {string}
|
||||
*/
|
||||
let buffer
|
||||
let bufferIndex = 0
|
||||
return {
|
||||
tokenize: tokenizeFrontmatter,
|
||||
concrete: true
|
||||
}
|
||||
|
||||
/**
|
||||
* @this {TokenizeContext}
|
||||
* @type {Tokenizer}
|
||||
*/
|
||||
function tokenizeFrontmatter(effects, ok, nok) {
|
||||
const self = this
|
||||
return start
|
||||
|
||||
/**
|
||||
* Start of frontmatter.
|
||||
*
|
||||
* ```markdown
|
||||
* > | ---
|
||||
* ^
|
||||
* | title: "Venus"
|
||||
* | ---
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function start(code) {
|
||||
const position = self.now()
|
||||
if (
|
||||
// Indent not allowed.
|
||||
position.column === 1 &&
|
||||
// Normally, only allowed in first line.
|
||||
(position.line === 1 || anywhere)
|
||||
) {
|
||||
buffer = fence(matter, 'open')
|
||||
bufferIndex = 0
|
||||
if (code === buffer.charCodeAt(bufferIndex)) {
|
||||
effects.enter(frontmatterType)
|
||||
effects.enter(fenceType)
|
||||
effects.enter(sequenceType)
|
||||
return openSequence(code)
|
||||
}
|
||||
}
|
||||
return nok(code)
|
||||
}
|
||||
|
||||
/**
|
||||
* In open sequence.
|
||||
*
|
||||
* ```markdown
|
||||
* > | ---
|
||||
* ^
|
||||
* | title: "Venus"
|
||||
* | ---
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function openSequence(code) {
|
||||
if (bufferIndex === buffer.length) {
|
||||
effects.exit(sequenceType)
|
||||
if (markdownSpace(code)) {
|
||||
effects.enter('whitespace')
|
||||
return openSequenceWhitespace(code)
|
||||
}
|
||||
return openAfter(code)
|
||||
}
|
||||
if (code === buffer.charCodeAt(bufferIndex++)) {
|
||||
effects.consume(code)
|
||||
return openSequence
|
||||
}
|
||||
return nok(code)
|
||||
}
|
||||
|
||||
/**
|
||||
* In whitespace after open sequence.
|
||||
*
|
||||
* ```markdown
|
||||
* > | ---␠
|
||||
* ^
|
||||
* | title: "Venus"
|
||||
* | ---
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function openSequenceWhitespace(code) {
|
||||
if (markdownSpace(code)) {
|
||||
effects.consume(code)
|
||||
return openSequenceWhitespace
|
||||
}
|
||||
effects.exit('whitespace')
|
||||
return openAfter(code)
|
||||
}
|
||||
|
||||
/**
|
||||
* After open sequence.
|
||||
*
|
||||
* ```markdown
|
||||
* > | ---
|
||||
* ^
|
||||
* | title: "Venus"
|
||||
* | ---
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function openAfter(code) {
|
||||
if (markdownLineEnding(code)) {
|
||||
effects.exit(fenceType)
|
||||
effects.enter('lineEnding')
|
||||
effects.consume(code)
|
||||
effects.exit('lineEnding')
|
||||
// Get ready for closing fence.
|
||||
buffer = fence(matter, 'close')
|
||||
bufferIndex = 0
|
||||
return effects.attempt(closingFenceConstruct, after, contentStart)
|
||||
}
|
||||
|
||||
// EOF is not okay.
|
||||
return nok(code)
|
||||
}
|
||||
|
||||
/**
|
||||
* Start of content chunk.
|
||||
*
|
||||
* ```markdown
|
||||
* | ---
|
||||
* > | title: "Venus"
|
||||
* ^
|
||||
* | ---
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function contentStart(code) {
|
||||
if (code === null || markdownLineEnding(code)) {
|
||||
return contentEnd(code)
|
||||
}
|
||||
effects.enter(valueType)
|
||||
return contentInside(code)
|
||||
}
|
||||
|
||||
/**
|
||||
* In content chunk.
|
||||
*
|
||||
* ```markdown
|
||||
* | ---
|
||||
* > | title: "Venus"
|
||||
* ^
|
||||
* | ---
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function contentInside(code) {
|
||||
if (code === null || markdownLineEnding(code)) {
|
||||
effects.exit(valueType)
|
||||
return contentEnd(code)
|
||||
}
|
||||
effects.consume(code)
|
||||
return contentInside
|
||||
}
|
||||
|
||||
/**
|
||||
* End of content chunk.
|
||||
*
|
||||
* ```markdown
|
||||
* | ---
|
||||
* > | title: "Venus"
|
||||
* ^
|
||||
* | ---
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function contentEnd(code) {
|
||||
// Require a closing fence.
|
||||
if (code === null) {
|
||||
return nok(code)
|
||||
}
|
||||
|
||||
// Can only be an eol.
|
||||
effects.enter('lineEnding')
|
||||
effects.consume(code)
|
||||
effects.exit('lineEnding')
|
||||
return effects.attempt(closingFenceConstruct, after, contentStart)
|
||||
}
|
||||
|
||||
/**
|
||||
* After frontmatter.
|
||||
*
|
||||
* ```markdown
|
||||
* | ---
|
||||
* | title: "Venus"
|
||||
* > | ---
|
||||
* ^
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function after(code) {
|
||||
// `code` must be eol/eof.
|
||||
effects.exit(frontmatterType)
|
||||
return ok(code)
|
||||
}
|
||||
}
|
||||
|
||||
/** @type {Tokenizer} */
|
||||
function tokenizeClosingFence(effects, ok, nok) {
|
||||
let bufferIndex = 0
|
||||
return closeStart
|
||||
|
||||
/**
|
||||
* Start of close sequence.
|
||||
*
|
||||
* ```markdown
|
||||
* | ---
|
||||
* | title: "Venus"
|
||||
* > | ---
|
||||
* ^
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function closeStart(code) {
|
||||
if (code === buffer.charCodeAt(bufferIndex)) {
|
||||
effects.enter(fenceType)
|
||||
effects.enter(sequenceType)
|
||||
return closeSequence(code)
|
||||
}
|
||||
return nok(code)
|
||||
}
|
||||
|
||||
/**
|
||||
* In close sequence.
|
||||
*
|
||||
* ```markdown
|
||||
* | ---
|
||||
* | title: "Venus"
|
||||
* > | ---
|
||||
* ^
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function closeSequence(code) {
|
||||
if (bufferIndex === buffer.length) {
|
||||
effects.exit(sequenceType)
|
||||
if (markdownSpace(code)) {
|
||||
effects.enter('whitespace')
|
||||
return closeSequenceWhitespace(code)
|
||||
}
|
||||
return closeAfter(code)
|
||||
}
|
||||
if (code === buffer.charCodeAt(bufferIndex++)) {
|
||||
effects.consume(code)
|
||||
return closeSequence
|
||||
}
|
||||
return nok(code)
|
||||
}
|
||||
|
||||
/**
|
||||
* In whitespace after close sequence.
|
||||
*
|
||||
* ```markdown
|
||||
* > | ---
|
||||
* | title: "Venus"
|
||||
* | ---␠
|
||||
* ^
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function closeSequenceWhitespace(code) {
|
||||
if (markdownSpace(code)) {
|
||||
effects.consume(code)
|
||||
return closeSequenceWhitespace
|
||||
}
|
||||
effects.exit('whitespace')
|
||||
return closeAfter(code)
|
||||
}
|
||||
|
||||
/**
|
||||
* After close sequence.
|
||||
*
|
||||
* ```markdown
|
||||
* | ---
|
||||
* | title: "Venus"
|
||||
* > | ---
|
||||
* ^
|
||||
* ```
|
||||
*
|
||||
* @type {State}
|
||||
*/
|
||||
function closeAfter(code) {
|
||||
if (code === null || markdownLineEnding(code)) {
|
||||
effects.exit(fenceType)
|
||||
return ok(code)
|
||||
}
|
||||
return nok(code)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Matter} matter
|
||||
* @param {'open' | 'close'} prop
|
||||
* @returns {string}
|
||||
*/
|
||||
function fence(matter, prop) {
|
||||
return matter.marker
|
||||
? pick(matter.marker, prop).repeat(3)
|
||||
: // @ts-expect-error: They’re mutually exclusive.
|
||||
pick(matter.fence, prop)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Info | string} schema
|
||||
* @param {'open' | 'close'} prop
|
||||
* @returns {string}
|
||||
*/
|
||||
function pick(schema, prop) {
|
||||
return typeof schema === 'string' ? schema : schema[prop]
|
||||
}
|
||||
22
node_modules/micromark-extension-frontmatter/license
generated
vendored
Normal file
22
node_modules/micromark-extension-frontmatter/license
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
(The MIT License)
|
||||
|
||||
Copyright (c) 2020 Titus Wormer <tituswormer@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
97
node_modules/micromark-extension-frontmatter/matters.d.ts
generated
vendored
Normal file
97
node_modules/micromark-extension-frontmatter/matters.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
/**
|
||||
* Simplify one or more options.
|
||||
*
|
||||
* @param {Options | null | undefined} [options='yaml']
|
||||
* Configuration.
|
||||
* @returns {Array<Matter>}
|
||||
* List of matters.
|
||||
*/
|
||||
export function matters(options?: Options | null | undefined): Array<Matter>
|
||||
/**
|
||||
* Known name of a frontmatter style.
|
||||
*/
|
||||
export type Preset = 'toml' | 'yaml'
|
||||
/**
|
||||
* Sequence.
|
||||
*
|
||||
* Depending on how this structure is used, it reflects a marker or a fence.
|
||||
*/
|
||||
export type Info = {
|
||||
/**
|
||||
* Opening.
|
||||
*/
|
||||
open: string
|
||||
/**
|
||||
* Closing.
|
||||
*/
|
||||
close: string
|
||||
}
|
||||
/**
|
||||
* Fields describing a kind of matter.
|
||||
*/
|
||||
export type MatterProps = {
|
||||
/**
|
||||
* Node type to tokenize as.
|
||||
*/
|
||||
type: string
|
||||
/**
|
||||
* Whether matter can be found anywhere in the document, normally, only matter
|
||||
* at the start of the document is recognized.
|
||||
*
|
||||
* > 👉 **Note**: using this is a terrible idea.
|
||||
* > It’s called frontmatter, not matter-in-the-middle or so.
|
||||
* > This makes your markdown less portable.
|
||||
*/
|
||||
anywhere?: boolean | null | undefined
|
||||
}
|
||||
/**
|
||||
* Marker configuration.
|
||||
*/
|
||||
export type MarkerProps = {
|
||||
/**
|
||||
* Character repeated 3 times, used as complete fences.
|
||||
*
|
||||
* For example the character `'-'` will result in `'---'` being used as the
|
||||
* fence
|
||||
* Pass `open` and `close` to specify different characters for opening and
|
||||
* closing fences.
|
||||
*/
|
||||
marker: Info | string
|
||||
/**
|
||||
* If `marker` is set, `fence` must not be set.
|
||||
*/
|
||||
fence?: never
|
||||
}
|
||||
/**
|
||||
* Fence configuration.
|
||||
*/
|
||||
export type FenceProps = {
|
||||
/**
|
||||
* Complete fences.
|
||||
*
|
||||
* This can be used when fences contain different characters or lengths
|
||||
* other than 3.
|
||||
* Pass `open` and `close` to interface to specify different characters for opening and
|
||||
* closing fences.
|
||||
*/
|
||||
fence: Info | string
|
||||
/**
|
||||
* If `fence` is set, `marker` must not be set.
|
||||
*/
|
||||
marker?: never
|
||||
}
|
||||
/**
|
||||
* Fields describing a kind of matter.
|
||||
*
|
||||
* > 👉 **Note**: using `anywhere` is a terrible idea.
|
||||
* > It’s called frontmatter, not matter-in-the-middle or so.
|
||||
* > This makes your markdown less portable.
|
||||
*
|
||||
* > 👉 **Note**: `marker` and `fence` are mutually exclusive.
|
||||
* > If `marker` is set, `fence` must not be set, and vice versa.
|
||||
*/
|
||||
export type Matter = (MatterProps & FenceProps) | (MatterProps & MarkerProps)
|
||||
/**
|
||||
* Configuration.
|
||||
*/
|
||||
export type Options = Matter | Preset | Array<Matter | Preset>
|
||||
124
node_modules/micromark-extension-frontmatter/matters.js
generated
vendored
Normal file
124
node_modules/micromark-extension-frontmatter/matters.js
generated
vendored
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
/**
|
||||
* @typedef {'toml' | 'yaml'} Preset
|
||||
* Known name of a frontmatter style.
|
||||
*
|
||||
* @typedef Info
|
||||
* Sequence.
|
||||
*
|
||||
* Depending on how this structure is used, it reflects a marker or a fence.
|
||||
* @property {string} open
|
||||
* Opening.
|
||||
* @property {string} close
|
||||
* Closing.
|
||||
*
|
||||
* @typedef MatterProps
|
||||
* Fields describing a kind of matter.
|
||||
* @property {string} type
|
||||
* Node type to tokenize as.
|
||||
* @property {boolean | null | undefined} [anywhere=false]
|
||||
* Whether matter can be found anywhere in the document, normally, only matter
|
||||
* at the start of the document is recognized.
|
||||
*
|
||||
* > 👉 **Note**: using this is a terrible idea.
|
||||
* > It’s called frontmatter, not matter-in-the-middle or so.
|
||||
* > This makes your markdown less portable.
|
||||
*
|
||||
* @typedef MarkerProps
|
||||
* Marker configuration.
|
||||
* @property {Info | string} marker
|
||||
* Character repeated 3 times, used as complete fences.
|
||||
*
|
||||
* For example the character `'-'` will result in `'---'` being used as the
|
||||
* fence
|
||||
* Pass `open` and `close` to specify different characters for opening and
|
||||
* closing fences.
|
||||
* @property {never} [fence]
|
||||
* If `marker` is set, `fence` must not be set.
|
||||
*
|
||||
* @typedef FenceProps
|
||||
* Fence configuration.
|
||||
* @property {Info | string} fence
|
||||
* Complete fences.
|
||||
*
|
||||
* This can be used when fences contain different characters or lengths
|
||||
* other than 3.
|
||||
* Pass `open` and `close` to interface to specify different characters for opening and
|
||||
* closing fences.
|
||||
* @property {never} [marker]
|
||||
* If `fence` is set, `marker` must not be set.
|
||||
*
|
||||
* @typedef {(MatterProps & FenceProps) | (MatterProps & MarkerProps)} Matter
|
||||
* Fields describing a kind of matter.
|
||||
*
|
||||
* > 👉 **Note**: using `anywhere` is a terrible idea.
|
||||
* > It’s called frontmatter, not matter-in-the-middle or so.
|
||||
* > This makes your markdown less portable.
|
||||
*
|
||||
* > 👉 **Note**: `marker` and `fence` are mutually exclusive.
|
||||
* > If `marker` is set, `fence` must not be set, and vice versa.
|
||||
*
|
||||
* @typedef {Matter | Preset | Array<Matter | Preset>} Options
|
||||
* Configuration.
|
||||
*/
|
||||
|
||||
import {fault} from 'fault'
|
||||
const own = {}.hasOwnProperty
|
||||
const markers = {
|
||||
yaml: '-',
|
||||
toml: '+'
|
||||
}
|
||||
|
||||
/**
|
||||
* Simplify one or more options.
|
||||
*
|
||||
* @param {Options | null | undefined} [options='yaml']
|
||||
* Configuration.
|
||||
* @returns {Array<Matter>}
|
||||
* List of matters.
|
||||
*/
|
||||
export function matters(options) {
|
||||
/** @type {Array<Matter>} */
|
||||
const result = []
|
||||
let index = -1
|
||||
|
||||
/** @type {Array<Matter | Preset>} */
|
||||
const presetsOrMatters = Array.isArray(options)
|
||||
? options
|
||||
: options
|
||||
? [options]
|
||||
: ['yaml']
|
||||
while (++index < presetsOrMatters.length) {
|
||||
result[index] = matter(presetsOrMatters[index])
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Simplify an option.
|
||||
*
|
||||
* @param {Matter | Preset} option
|
||||
* Configuration.
|
||||
* @returns {Matter}
|
||||
* Matters.
|
||||
*/
|
||||
function matter(option) {
|
||||
let result = option
|
||||
if (typeof result === 'string') {
|
||||
if (!own.call(markers, result)) {
|
||||
throw fault('Missing matter definition for `%s`', result)
|
||||
}
|
||||
result = {
|
||||
type: result,
|
||||
marker: markers[result]
|
||||
}
|
||||
} else if (typeof result !== 'object') {
|
||||
throw fault('Expected matter to be an object, not `%j`', result)
|
||||
}
|
||||
if (!own.call(result, 'type')) {
|
||||
throw fault('Missing `type` in matter `%j`', result)
|
||||
}
|
||||
if (!own.call(result, 'fence') && !own.call(result, 'marker')) {
|
||||
throw fault('Missing `marker` or `fence` in matter `%j`', result)
|
||||
}
|
||||
return result
|
||||
}
|
||||
104
node_modules/micromark-extension-frontmatter/package.json
generated
vendored
Normal file
104
node_modules/micromark-extension-frontmatter/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
{
|
||||
"name": "micromark-extension-frontmatter",
|
||||
"version": "1.1.1",
|
||||
"description": "micromark extension to support frontmatter (YAML, TOML, etc)",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"micromark",
|
||||
"micromark-extension",
|
||||
"frontmatter",
|
||||
"yaml",
|
||||
"toml",
|
||||
"gfm",
|
||||
"markdown",
|
||||
"unified"
|
||||
],
|
||||
"repository": "micromark/micromark-extension-frontmatter",
|
||||
"bugs": "https://github.com/micromark/micromark-extension-frontmatter/issues",
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/unified"
|
||||
},
|
||||
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
||||
"contributors": [
|
||||
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"files": [
|
||||
"dev/",
|
||||
"lib/",
|
||||
"matters.d.ts",
|
||||
"matters.js",
|
||||
"index.d.ts",
|
||||
"index.js"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"development": "./dev/index.js",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"./matters": {
|
||||
"development": "./dev/matters.js",
|
||||
"default": "./matters.js"
|
||||
},
|
||||
"./matters.js": {
|
||||
"development": "./dev/matters.js",
|
||||
"default": "./matters.js"
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"fault": "^2.0.0",
|
||||
"micromark-util-character": "^1.0.0",
|
||||
"micromark-util-symbol": "^1.0.0",
|
||||
"micromark-util-types": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.0.0",
|
||||
"c8": "^7.0.0",
|
||||
"micromark": "^3.0.0",
|
||||
"micromark-build": "^1.0.0",
|
||||
"prettier": "^2.0.0",
|
||||
"remark-cli": "^11.0.0",
|
||||
"remark-preset-wooorm": "^9.0.0",
|
||||
"type-coverage": "^2.0.0",
|
||||
"typescript": "^5.0.0",
|
||||
"xo": "^0.54.0"
|
||||
},
|
||||
"scripts": {
|
||||
"prepack": "npm run build && npm run format",
|
||||
"build": "tsc --build --clean && tsc --build && type-coverage && micromark-build",
|
||||
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
|
||||
"test-api": "node --conditions development test/index.js",
|
||||
"test-coverage": "c8 --100 --reporter lcov npm run test-api",
|
||||
"test": "npm run build && npm run format && npm run test-coverage"
|
||||
},
|
||||
"prettier": {
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"bracketSpacing": false,
|
||||
"semi": false,
|
||||
"trailingComma": "none"
|
||||
},
|
||||
"xo": {
|
||||
"prettier": true,
|
||||
"rules": {
|
||||
"unicorn/no-this-assignment": "off",
|
||||
"unicorn/prefer-code-point": "off"
|
||||
}
|
||||
},
|
||||
"remarkConfig": {
|
||||
"plugins": [
|
||||
"remark-preset-wooorm"
|
||||
]
|
||||
},
|
||||
"typeCoverage": {
|
||||
"atLeast": 100,
|
||||
"detail": true,
|
||||
"strict": true,
|
||||
"ignoreCatch": true
|
||||
}
|
||||
}
|
||||
411
node_modules/micromark-extension-frontmatter/readme.md
generated
vendored
Normal file
411
node_modules/micromark-extension-frontmatter/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,411 @@
|
|||
# micromark-extension-frontmatter
|
||||
|
||||
[![Build][build-badge]][build]
|
||||
[![Coverage][coverage-badge]][coverage]
|
||||
[![Downloads][downloads-badge]][downloads]
|
||||
[![Size][size-badge]][size]
|
||||
[![Sponsors][sponsors-badge]][collective]
|
||||
[![Backers][backers-badge]][collective]
|
||||
[![Chat][chat-badge]][chat]
|
||||
|
||||
[micromark][] extensions to support frontmatter (YAML, TOML, and more).
|
||||
|
||||
## Contents
|
||||
|
||||
* [What is this?](#what-is-this)
|
||||
* [When to use this](#when-to-use-this)
|
||||
* [Install](#install)
|
||||
* [Use](#use)
|
||||
* [API](#api)
|
||||
* [`frontmatter(options?)`](#frontmatteroptions)
|
||||
* [`frontmatterHtml(options?)`](#frontmatterhtmloptions)
|
||||
* [`Info`](#info)
|
||||
* [`Matter`](#matter)
|
||||
* [`Options`](#options)
|
||||
* [`Preset`](#preset)
|
||||
* [Examples](#examples)
|
||||
* [Authoring](#authoring)
|
||||
* [HTML](#html)
|
||||
* [CSS](#css)
|
||||
* [Syntax](#syntax)
|
||||
* [Types](#types)
|
||||
* [Compatibility](#compatibility)
|
||||
* [Security](#security)
|
||||
* [Related](#related)
|
||||
* [Contribute](#contribute)
|
||||
* [License](#license)
|
||||
|
||||
## What is this?
|
||||
|
||||
This package contains two extensions that add support for frontmatter syntax
|
||||
as often used in markdown to [`micromark`][micromark].
|
||||
|
||||
Frontmatter is a metadata format in front of the content.
|
||||
It’s typically written in YAML and is often used with markdown.
|
||||
Frontmatter does not work everywhere so it makes markdown less portable.
|
||||
|
||||
As there is no spec for frontmatter in markdown, these extensions follow how
|
||||
YAML frontmatter works on `github.com`.
|
||||
It can also parse TOML frontmatter, just like YAML except that it uses a `+`.
|
||||
|
||||
## When to use this
|
||||
|
||||
You can use these extensions when you are working with [`micromark`][micromark]
|
||||
already.
|
||||
|
||||
When you need a syntax tree, you can combine this package with
|
||||
[`mdast-util-frontmatter`][mdast-util-frontmatter].
|
||||
|
||||
All these packages are used [`remark-frontmatter`][remark-frontmatter], which
|
||||
focusses on making it easier to transform content by abstracting these
|
||||
internals away.
|
||||
|
||||
## Install
|
||||
|
||||
This package is [ESM only][esm].
|
||||
In Node.js (version 14.14+), install with [npm][]:
|
||||
|
||||
```sh
|
||||
npm install micromark-extension-frontmatter
|
||||
```
|
||||
|
||||
In Deno with [`esm.sh`][esmsh]:
|
||||
|
||||
```js
|
||||
import {frontmatter, frontmatterHtml} from 'https://esm.sh/micromark-extension-frontmatter@1'
|
||||
```
|
||||
|
||||
In browsers with [`esm.sh`][esmsh]:
|
||||
|
||||
```html
|
||||
<script type="module">
|
||||
import {frontmatter, frontmatterHtml} from 'https://esm.sh/micromark-extension-frontmatter@1?bundle'
|
||||
</script>
|
||||
```
|
||||
|
||||
## Use
|
||||
|
||||
Say our module `example.js` looks as follows:
|
||||
|
||||
```js
|
||||
import {micromark} from 'micromark'
|
||||
import {frontmatter, frontmatterHtml} from 'micromark-extension-frontmatter'
|
||||
|
||||
const output = micromark('---\na: b\n---\n# c', {
|
||||
extensions: [frontmatter()],
|
||||
htmlExtensions: [frontmatterHtml()]
|
||||
})
|
||||
|
||||
console.log(output)
|
||||
```
|
||||
|
||||
…now running `node example.js` yields:
|
||||
|
||||
```html
|
||||
<h1>c</h1>
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
This package exports the identifiers [`frontmatter`][api-frontmatter] and
|
||||
[`frontmatterHtml`][api-frontmatter-html].
|
||||
There is no default export.
|
||||
|
||||
The export map supports the [`development` condition][development].
|
||||
Run `node --conditions development module.js` to get instrumented dev code.
|
||||
Without this condition, production code is loaded.
|
||||
|
||||
### `frontmatter(options?)`
|
||||
|
||||
Create an extension for [`micromark`][micromark] to enable frontmatter syntax.
|
||||
|
||||
###### Parameters
|
||||
|
||||
* `options` ([`Options`][api-options], default: `['yaml']`)
|
||||
— configuration
|
||||
|
||||
###### Returns
|
||||
|
||||
Extension for `micromark` that can be passed in `extensions`, to enable
|
||||
frontmatter syntax ([`Extension`][micromark-extension]).
|
||||
|
||||
### `frontmatterHtml(options?)`
|
||||
|
||||
Create an extension for `micromark` to support frontmatter when serializing to
|
||||
HTML.
|
||||
|
||||
> 👉 **Note**: this makes sure nothing is generated in the output HTML for
|
||||
> frontmatter.
|
||||
|
||||
###### Parameters
|
||||
|
||||
* `options` ([`Options`][api-options], default: `['yaml']`)
|
||||
— configuration
|
||||
|
||||
###### Returns
|
||||
|
||||
Extension for `micromark` that can be passed in `htmlExtensions`, to support
|
||||
frontmatter when serializing to HTML
|
||||
([`HtmlExtension`][micromark-html-extension]).
|
||||
|
||||
### `Info`
|
||||
|
||||
Sequence (TypeScript type).
|
||||
|
||||
Depending on how this structure is used, it reflects a marker or a fence.
|
||||
|
||||
###### Fields
|
||||
|
||||
* `open` (`string`)
|
||||
— opening
|
||||
* `close` (`string`)
|
||||
— closing
|
||||
|
||||
### `Matter`
|
||||
|
||||
Fields describing a kind of matter (TypeScript type).
|
||||
|
||||
> 👉 **Note**: using `anywhere` is a terrible idea.
|
||||
> It’s called frontmatter, not matter-in-the-middle or so.
|
||||
> This makes your markdown less portable.
|
||||
|
||||
> 👉 **Note**: `marker` and `fence` are mutually exclusive.
|
||||
> If `marker` is set, `fence` must not be set, and vice versa.
|
||||
|
||||
###### Fields
|
||||
|
||||
* `type` (`string`)
|
||||
— node type to tokenize as
|
||||
* `marker` (`string` or [`Info`][api-info])
|
||||
— character repeated 3 times, used as complete fences
|
||||
* `fence` (`string` or [`Info`][api-info])
|
||||
— complete fences
|
||||
* `anywhere` (`boolean`, default: `false`)
|
||||
— whether matter can be found anywhere in the document, normally only
|
||||
matter at the start of the document is recognized
|
||||
|
||||
### `Options`
|
||||
|
||||
Configuration (TypeScript type).
|
||||
|
||||
###### Type
|
||||
|
||||
```ts
|
||||
type Options = Matter | Preset | Array<Matter | Preset>
|
||||
```
|
||||
|
||||
### `Preset`
|
||||
|
||||
Known name of a frontmatter style (TypeScript type).
|
||||
|
||||
* `'yaml'` — [`Matter`][api-matter] defined as `{type: 'yaml', marker: '-'}`
|
||||
* `'toml'` — [`Matter`][api-matter] defined as `{type: 'toml', marker: '+'}`
|
||||
|
||||
###### Type
|
||||
|
||||
```ts
|
||||
type Preset = 'toml' | 'yaml'
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
Here are a couple of example of different matter objects and what frontmatter
|
||||
they match.
|
||||
|
||||
To match frontmatter with the same opening and closing fence, namely three of
|
||||
the same markers, use for example `{type: 'yaml', marker: '-'}`, which matches:
|
||||
|
||||
```yaml
|
||||
---
|
||||
key: value
|
||||
---
|
||||
```
|
||||
|
||||
To match frontmatter with different opening and closing fences, which each use
|
||||
three different markers, use for example
|
||||
`{type: 'custom', marker: {open: '<', close: '>'}}`, which matches:
|
||||
|
||||
```text
|
||||
<<<
|
||||
data
|
||||
>>>
|
||||
```
|
||||
|
||||
To match frontmatter with the same opening and closing fences, which both use
|
||||
the same custom string, use for example `{type: 'custom', fence: '+=+=+=+'}`,
|
||||
which matches:
|
||||
|
||||
```text
|
||||
+=+=+=+
|
||||
data
|
||||
+=+=+=+
|
||||
```
|
||||
|
||||
To match frontmatter with different opening and closing fences, which each use
|
||||
different custom strings, use for example
|
||||
`{type: 'json', fence: {open: '{', close: '}'}}`, which matches:
|
||||
|
||||
```json
|
||||
{
|
||||
"key": "value"
|
||||
}
|
||||
```
|
||||
|
||||
## Authoring
|
||||
|
||||
When authoring markdown with frontmatter, it’s recommended to use YAML
|
||||
frontmatter if possible.
|
||||
While YAML has some warts, it works in the most places, so using it guarantees
|
||||
the highest chance of portability.
|
||||
|
||||
In certain ecosystems, other flavors are widely used.
|
||||
For example, in the Rust ecosystem, TOML is often used.
|
||||
In such cases, using TOML is an okay choice.
|
||||
|
||||
When possible, do not use other types of frontmatter, and do not allow
|
||||
frontmatter anywhere.
|
||||
|
||||
## HTML
|
||||
|
||||
Frontmatter does not relate to HTML elements.
|
||||
It is typically stripped, which is what these extensions do.
|
||||
|
||||
## CSS
|
||||
|
||||
This package does not relate to CSS.
|
||||
|
||||
## Syntax
|
||||
|
||||
Frontmatter forms with the following BNF:
|
||||
|
||||
```bnf
|
||||
frontmatter ::= fence_open *( eol *line ) eol fence_close
|
||||
fence_open ::= sequence_open *space_or_tab
|
||||
fence_close ::= sequence_close *space_or_tab
|
||||
; Note: options can define custom sequences.
|
||||
sequence_open ::= 3'+' | 3'-'
|
||||
; Note: options can define custom sequences.
|
||||
; Restriction: `sequence_close` must correspond to `sequence_open`.
|
||||
sequence_close ::= 3'+' | 3'-'
|
||||
|
||||
; Character groups for informational purposes.
|
||||
byte ::= 0x00..=0xFFFF
|
||||
eol ::= '\n' | '\r' | '\r\n'
|
||||
line ::= byte - eol
|
||||
```
|
||||
|
||||
Frontmatter can only occur once.
|
||||
It cannot occur in a container.
|
||||
It must have a closing fence.
|
||||
Like flow constructs, it must be followed by an eol (line ending) or
|
||||
eof (end of file).
|
||||
|
||||
## Types
|
||||
|
||||
This package is fully typed with [TypeScript][].
|
||||
It exports the additional types [`Info`][api-info], [`Matter`][api-matter],
|
||||
[`Options`][api-options], [`Preset`][api-preset].
|
||||
|
||||
## Compatibility
|
||||
|
||||
Projects maintained by the unified collective are compatible with all maintained
|
||||
versions of Node.js.
|
||||
As of now, that is Node.js 14.14+.
|
||||
Our projects sometimes work with older versions, but this is not guaranteed.
|
||||
|
||||
These extensions work with `micromark` version 3+.
|
||||
|
||||
## Security
|
||||
|
||||
This package is safe.
|
||||
|
||||
## Related
|
||||
|
||||
* [`remark-frontmatter`][remark-frontmatter]
|
||||
— remark plugin using this to support frontmatter
|
||||
* [`mdast-util-frontmatter`][mdast-util-frontmatter]
|
||||
— mdast utility to support frontmatter
|
||||
|
||||
## Contribute
|
||||
|
||||
See [`contributing.md` in `micromark/.github`][contributing] for ways to get
|
||||
started.
|
||||
See [`support.md`][support] for ways to get help.
|
||||
|
||||
This project has a [code of conduct][coc].
|
||||
By interacting with this repository, organization, or community you agree to
|
||||
abide by its terms.
|
||||
|
||||
## License
|
||||
|
||||
[MIT][license] © [Titus Wormer][author]
|
||||
|
||||
<!-- Definitions -->
|
||||
|
||||
[build-badge]: https://github.com/micromark/micromark-extension-frontmatter/workflows/main/badge.svg
|
||||
|
||||
[build]: https://github.com/micromark/micromark-extension-frontmatter/actions
|
||||
|
||||
[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark-extension-frontmatter.svg
|
||||
|
||||
[coverage]: https://codecov.io/github/micromark/micromark-extension-frontmatter
|
||||
|
||||
[downloads-badge]: https://img.shields.io/npm/dm/micromark-extension-frontmatter.svg
|
||||
|
||||
[downloads]: https://www.npmjs.com/package/micromark-extension-frontmatter
|
||||
|
||||
[size-badge]: https://img.shields.io/bundlephobia/minzip/micromark-extension-frontmatter.svg
|
||||
|
||||
[size]: https://bundlephobia.com/result?p=micromark-extension-frontmatter
|
||||
|
||||
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
|
||||
|
||||
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
|
||||
|
||||
[collective]: https://opencollective.com/unified
|
||||
|
||||
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
|
||||
|
||||
[chat]: https://github.com/micromark/micromark/discussions
|
||||
|
||||
[npm]: https://docs.npmjs.com/cli/install
|
||||
|
||||
[esmsh]: https://esm.sh
|
||||
|
||||
[license]: license
|
||||
|
||||
[author]: https://wooorm.com
|
||||
|
||||
[contributing]: https://github.com/micromark/.github/blob/main/contributing.md
|
||||
|
||||
[support]: https://github.com/micromark/.github/blob/main/support.md
|
||||
|
||||
[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md
|
||||
|
||||
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
||||
|
||||
[typescript]: https://www.typescriptlang.org
|
||||
|
||||
[development]: https://nodejs.org/api/packages.html#packages_resolving_user_conditions
|
||||
|
||||
[micromark]: https://github.com/micromark/micromark
|
||||
|
||||
[mdast-util-frontmatter]: https://github.com/syntax-tree/mdast-util-frontmatter
|
||||
|
||||
[remark-frontmatter]: https://github.com/remarkjs/remark-frontmatter
|
||||
|
||||
[micromark-extension]: https://github.com/micromark/micromark#syntaxextension
|
||||
|
||||
[micromark-html-extension]: https://github.com/micromark/micromark#htmlextension
|
||||
|
||||
[api-frontmatter]: #frontmatteroptions
|
||||
|
||||
[api-frontmatter-html]: #frontmatterhtmloptions
|
||||
|
||||
[api-info]: #info
|
||||
|
||||
[api-matter]: #matter
|
||||
|
||||
[api-options]: #options
|
||||
|
||||
[api-preset]: #preset
|
||||
Loading…
Add table
Add a link
Reference in a new issue