Urara-Blog/node_modules/.pnpm-store/v3/files/18/eb3e5be516a26500371a2190b19919e0bed0c2dbb04fcf4ea2a9475616d62136aecb971ad0958a6d9b040ab01ce15df09e1508d929dc1037a9f0e823600a09
2022-08-14 01:14:53 +08:00

40 lines
1.1 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))
)
)
}