basant307/AI_Governance_Project
048
1/**2 * @import {Encoding, Value} from 'micromark-util-types'3 */4 5/**6 * @typedef {import('micromark-util-types').Options} Options7 */8 9import { compile } from './lib/compile.js';10import { parse } from './lib/parse.js';11import { postprocess } from './lib/postprocess.js';12import { preprocess } from './lib/preprocess.js';13export { compile } from './lib/compile.js';14export { parse } from './lib/parse.js';15export { postprocess } from './lib/postprocess.js';16export { preprocess } from './lib/preprocess.js';17 18/**19 * Compile markdown to HTML.20 *21 * > Note: which encodings are supported depends on the engine.22 * > For info on Node.js, see:23 * > <https://nodejs.org/api/util.html#whatwg-supported-encodings>.24 *25 * @overload26 * @param {Value} value27 * Markdown to parse (`string` or `Uint8Array`).28 * @param {Encoding | null | undefined} encoding29 * Character encoding to understand `value` as when it’s a `Uint8Array`30 * (`string`, default: `'utf8'`).31 * @param {Options | null | undefined} [options]32 * Configuration.33 * @returns {string}34 * Compiled HTML.35 *36 * @overload37 * @param {Value} value38 * Markdown to parse (`string` or `Uint8Array`).39 * @param {Options | null | undefined} [options]40 * Configuration.41 * @returns {string}42 * Compiled HTML.43 *44 * @param {Value} value45 * Markdown to parse (`string` or `Uint8Array`).46 * @param {Encoding | Options | null | undefined} [encoding]47 * Character encoding to understand `value` as when it’s a `Uint8Array`48 * (`string`, default: `'utf8'`).49 * @param {Options | null | undefined} [options]50 * Configuration.51 * @returns {string}52 * Compiled HTML.53 */54export function micromark(value, encoding, options) {55 if (typeof encoding !== 'string') {56 options = encoding;57 encoding = undefined;58 }59 return compile(options)(postprocess(parse(options).document().write(preprocess()(value, encoding, true))));60}