Urara-Blog/node_modules/.pnpm-store/v3/files/2d/8851e936c9bb5779361c2223e62d4e290f612abf2e2d77379c3f63a95e73af3a24fa88bb58dcc11c64d6a0ecef4397247da352548a36ce07681467a8ee2371
2022-08-14 01:14:53 +08:00

42 lines
1.2 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @typedef {import('micromark-util-types').Options} Options
* @typedef {import('micromark-util-types').Value} Value
* @typedef {import('micromark-util-types').Encoding} Encoding
*/
import {compile} from './lib/compile.js'
import {parse} from './lib/parse.js'
import {postprocess} from './lib/postprocess.js'
import {preprocess} from './lib/preprocess.js'
/**
* @param value Markdown to parse (`string` or `Buffer`).
* @param [encoding] Character encoding to understand `value` as when its a `Buffer` (`string`, default: `'utf8'`).
* @param [options] Configuration
*/
export const micromark =
/**
* @type {(
* ((value: Value, encoding: Encoding, options?: Options) => string) &
* ((value: Value, options?: Options) => string)
* )}
*/
(
/**
* @param {Value} value
* @param {Encoding} [encoding]
* @param {Options} [options]
*/
function (value, encoding, options) {
if (typeof encoding !== 'string') {
options = encoding
encoding = undefined
}
return compile(options)(
postprocess(
parse(options).document().write(preprocess()(value, encoding, true))
)
)
}
)