You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
17 KiB
JavaScript

9 months ago
"use strict";
/*
* ATTENTION: An "eval-source-map" devtool has been used.
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file with attached SourceMaps in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
exports.id = "vendor-chunks/rehype-highlight";
exports.ids = ["vendor-chunks/rehype-highlight"];
exports.modules = {
/***/ "(ssr)/./node_modules/rehype-highlight/lib/index.js":
/*!****************************************************!*\
!*** ./node_modules/rehype-highlight/lib/index.js ***!
\****************************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ rehypeHighlight)\n/* harmony export */ });\n/* harmony import */ var lowlight__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lowlight */ \"(ssr)/./node_modules/lowlight/index.js\");\n/* harmony import */ var hast_util_to_text__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! hast-util-to-text */ \"(ssr)/./node_modules/hast-util-to-text/lib/index.js\");\n/* harmony import */ var unist_util_visit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! unist-util-visit */ \"(ssr)/./node_modules/unist-util-visit/lib/index.js\");\n/**\n * @typedef {import('lowlight').Root} LowlightRoot\n * @typedef {import('lowlight/lib/core.js').HighlightSyntax} HighlightSyntax\n * @typedef {import('hast').Root} Root\n * @typedef {import('hast').Element} Element\n * @typedef {Root|Root['children'][number]} Node\n *\n * @typedef Options\n * Configuration (optional).\n * @property {string} [prefix='hljs-']\n * Prefix to use before classes.\n * @property {boolean} [detect=false]\n * Whether to detect the programming language on code without a language\n * class.\n * @property {Array<string>} [subset]\n * Scope of languages to check when auto-detecting (default: all languages).\n * @property {boolean} [ignoreMissing=false]\n * Swallow errors for missing languages.\n * By default, unregistered syntaxes throw an error when they are used.\n * Pass `true` to swallow those errors and thus ignore code with unknown code\n * languages.\n * @property {Array<string>} [plainText=[]]\n * List of plain-text languages.\n * Pass any languages you would like to be kept as plain-text instead of\n * getting highlighted.\n * @property {Record<string, string|Array<string>>} [aliases={}]\n * Register more aliases.\n * Passed to `lowlight.registerAlias`.\n * @property {Record<string, HighlightSyntax>} [languages={}]\n * Register more languages.\n * Each key/value pair passed as arguments to `lowlight.registerLanguage`.\n */ \n\n\nconst own = {}.hasOwnProperty;\n/**\n * Plugin to highlight the syntax of code with lowlight (`highlight.js`).\n *\n * @type {import('unified').Plugin<[Options?] | Array<void>, Root>}\n */ function rehypeHighlight(options = {}) {\n const { aliases, languages, prefix, plainText, ignoreMissing, subset, detect } = options;\n let name = \"hljs\";\n if (aliases) {\n lowlight__WEBPACK_IMPORTED_MODULE_0__.lowlight.registerAlias(aliases);\n }\n if (languages) {\n /** @type {string} */ let key;\n for(key in languages){\n if (own.call(languages, key)) {\n lowlight__WEBPACK_IMPORTED_MODULE_0__.lowlight.registerLanguage(key, languages[key]);\n }\n }\n }\n if (prefix) {\n const pos = prefix.indexOf(\"-\");\n name = pos > -1 ? prefix.slice(0, pos) : prefix;\n }\n return (tree, file)=>{\n // eslint-disable-next-line complexity\n (0,unist_util_visit__WEBPACK_IMPORTED_MODULE_1__.visit)(tree, \"element\", (node, _, givenParent)=>{\n const parent = /** @type {Node?} */ givenParent;\n if (!parent || !(\"tagName\" in parent) || parent.tagName !== \"pre\" || node.tagName !== \"code\" || !node.properties) {\n return;\n }\n const lang = language(node);\n if (lang === false || !lang && !detect || lang && plainText && plainText.includes(lang)) {\n return;\n }\n if (!Array.isArray(node.properties.className)) {\n node.properties.className = [];\n }\n if (!node.properties.className.includes(name)) {\n node.properties.className.unshift(name);\n }\n /** @type {LowlightRoot} */ let result;\n try {\n result = lang ? lowlight__WEBPACK_IMPORTED_MODULE_0__.lowlight.highlight(lang, (0,hast_util_to_text__WEBPACK_IMPORTED_MODULE_2__.toText)(pa
/***/ })
};
;