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
12 KiB
JavaScript
25 lines
12 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-katex";
|
||
|
|
exports.ids = ["vendor-chunks/rehype-katex"];
|
||
|
|
exports.modules = {
|
||
|
|
|
||
|
|
/***/ "(ssr)/./node_modules/rehype-katex/index.js":
|
||
|
|
/*!********************************************!*\
|
||
|
|
!*** ./node_modules/rehype-katex/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 */ rehypeKatex)\n/* harmony export */ });\n/* harmony import */ var katex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! katex */ \"(ssr)/./node_modules/katex/dist/katex.mjs\");\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/* 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 hast_util_from_html_isomorphic__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! hast-util-from-html-isomorphic */ \"(ssr)/./node_modules/hast-util-from-html-isomorphic/lib/index.js\");\n/**\n * @typedef {import('hast').Root} Root\n * @typedef {import('katex').KatexOptions} Options\n */ \n\n\n\nconst assign = Object.assign;\nconst source = \"rehype-katex\";\n/**\n * Plugin to transform `<span class=math-inline>` and `<div class=math-display>`\n * with KaTeX.\n *\n * @type {import('unified').Plugin<[Options?]|void[], Root>}\n */ function rehypeKatex(options) {\n const settings = options || {};\n const throwOnError = settings.throwOnError || false;\n return (tree, file)=>{\n (0,unist_util_visit__WEBPACK_IMPORTED_MODULE_1__.visit)(tree, \"element\", (element)=>{\n const classes = element.properties && Array.isArray(element.properties.className) ? element.properties.className : [];\n const inline = classes.includes(\"math-inline\");\n const displayMode = classes.includes(\"math-display\");\n if (!inline && !displayMode) {\n return;\n }\n const value = (0,hast_util_to_text__WEBPACK_IMPORTED_MODULE_2__.toText)(element, {\n whitespace: \"pre\"\n });\n /** @type {string} */ let result;\n try {\n result = katex__WEBPACK_IMPORTED_MODULE_0__[\"default\"].renderToString(value, assign({}, settings, {\n displayMode,\n throwOnError: true\n }));\n } catch (error_) {\n const error = /** @type {Error} */ error_;\n const fn = throwOnError ? \"fail\" : \"message\";\n const origin = [\n source,\n error.name.toLowerCase()\n ].join(\":\");\n file[fn](error.message, element.position, origin);\n // KaTeX can handle `ParseError` itself, but not others.\n // Generate similar markup if this is an other error.\n // See: <https://github.com/KaTeX/KaTeX/blob/5dc7af0/docs/error.md>.\n if (error.name !== \"ParseError\") {\n element.children = [\n {\n type: \"element\",\n tagName: \"span\",\n properties: {\n className: [\n \"katex-error\"\n ],\n title: String(error),\n style: \"color:\" + (settings.errorColor || \"#cc0000\")\n },\n children: [\n {\n type: \"text\",\n value\n }\n ]\n }\n ];\n return;\n }\n result = katex__WEBPACK_IMPORTED_MODULE_0__[\"default\"].renderToString(value, assign({}, settings, {\n displayMode,\n throwOnError: false,\n strict: \"ignore\"\n }));\n }\n
|
||
|
|
|
||
|
|
/***/ })
|
||
|
|
|
||
|
|
};
|
||
|
|
;
|