mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 11:18:39 +00:00
[plugin system] Add defineSymbol to the main katex object (#1263)
* Expose defineSymbol in the main KaTeX object * More Unicode letters (#1260) This PR serves as a complement to PR #1232 by supporting some letters that are omitted from the Unicode range 1D400–1D7FF. * Include Bold-Italic fonts for \boldsymbol (#1257) * Include Bold-Italic fonts for \boldsymbol Fix #1228 * Update screenshots * README: Add size badge (#1253) * README: Add size badge Add a size badge showing size of gzipped katex.min.js * update-sri: Add code to replace size badge in readme * Change to use badge from shields.io instead My bad for assuming that badgesize.io supports https. Change to use the badge from shields.io which supports https. * More Unicode letters (#1260) This PR serves as a complement to PR #1232 by supporting some letters that are omitted from the Unicode range 1D400–1D7FF. * Include Bold-Italic fonts for \boldsymbol (#1257) * Include Bold-Italic fonts for \boldsymbol Fix #1228 * Update screenshots * README: Add size badge Add a size badge showing size of gzipped katex.min.js * update-sri: Add code to replace size badge in readme * Change to use badge from shields.io instead My bad for assuming that badgesize.io supports https. Change to use the badge from shields.io which supports https. * Use badgesize.io with https * Fix space width in \texttt (#1261) * Fix space width in \texttt Fix #1255 via https://github.com/KaTeX/katex-fonts/pull/41. Also fix width metrics via https://github.com/KaTeX/katex-fonts/pull/42. * Improve test * Update screenshots
This commit is contained in:
committed by
Kevin Barabash
parent
b4b57cbc2b
commit
bd7a977404
7
katex.js
7
katex.js
@@ -18,6 +18,8 @@ import utils from "./src/utils";
|
|||||||
import type {SettingsOptions} from "./src/Settings";
|
import type {SettingsOptions} from "./src/Settings";
|
||||||
import type ParseNode from "./src/ParseNode";
|
import type ParseNode from "./src/ParseNode";
|
||||||
|
|
||||||
|
import { defineSymbol } from './src/symbols';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse and build an expression, and place that expression in the DOM node
|
* Parse and build an expression, and place that expression in the DOM node
|
||||||
* given.
|
* given.
|
||||||
@@ -68,7 +70,6 @@ const generateParseTree = function(
|
|||||||
return parseTree(expression, settings);
|
return parseTree(expression, settings);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates and returns the katex build tree. This is used for advanced
|
* Generates and returns the katex build tree. This is used for advanced
|
||||||
* use cases (like rendering to custom output).
|
* use cases (like rendering to custom output).
|
||||||
@@ -137,4 +138,8 @@ export default {
|
|||||||
* to change. Use at your own risk.
|
* to change. Use at your own risk.
|
||||||
*/
|
*/
|
||||||
__renderToHTMLTree: renderToHTMLTree,
|
__renderToHTMLTree: renderToHTMLTree,
|
||||||
|
/**
|
||||||
|
* adds a new symbol to internal symbols table
|
||||||
|
*/
|
||||||
|
__defineSymbol: defineSymbol,
|
||||||
};
|
};
|
||||||
|
@@ -61,6 +61,7 @@
|
|||||||
"test:lint": "eslint katex.js katex.webpack.js cli.js webpack.common.js webpack.config.js webpack.dev.js src static test contrib dockers && stylelint src/katex.less",
|
"test:lint": "eslint katex.js katex.webpack.js cli.js webpack.common.js webpack.config.js webpack.dev.js src static test contrib dockers && stylelint src/katex.less",
|
||||||
"test:flow": "flow",
|
"test:flow": "flow",
|
||||||
"test:jest": "jest",
|
"test:jest": "jest",
|
||||||
|
"test:jest:watch": "jest --watch",
|
||||||
"test:jest:update": "jest --updateSnapshot",
|
"test:jest:update": "jest --updateSnapshot",
|
||||||
"test:jest:coverage": "jest --coverage",
|
"test:jest:coverage": "jest --coverage",
|
||||||
"test:screenshots": "npm run test:screenshots:update -- --verify",
|
"test:screenshots": "npm run test:screenshots:update -- --verify",
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
import type {Mode} from "./types";
|
import type {Mode} from "./types";
|
||||||
|
|
||||||
type Font = "main" | "ams";
|
type Font = "main" | "ams"
|
||||||
type Group =
|
type Group =
|
||||||
"accent" | "bin" | "close" | "inner" | "mathord" | "op" | "open" | "punct" |
|
"accent" | "bin" | "close" | "inner" | "mathord" | "op" | "open" | "punct" |
|
||||||
"rel" | "spacing" | "textord";
|
"rel" | "spacing" | "textord";
|
||||||
@@ -32,7 +32,7 @@ const symbols: {[Mode]: CharInfoMap} = {
|
|||||||
export default symbols;
|
export default symbols;
|
||||||
|
|
||||||
/** `acceptUnicodeChar = true` is only applicable if `replace` is set. */
|
/** `acceptUnicodeChar = true` is only applicable if `replace` is set. */
|
||||||
function defineSymbol(
|
export function defineSymbol(
|
||||||
mode: Mode,
|
mode: Mode,
|
||||||
font: Font,
|
font: Font,
|
||||||
group: Group,
|
group: Group,
|
||||||
|
Reference in New Issue
Block a user