diff options
author | Disorder AA <disorrder@gmail.com> | 2023-05-04 17:21:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-04 15:21:01 +0000 |
commit | 30076a590b6630bb5290d81ad77ec2de3d864868 (patch) | |
tree | 69e02e84464722119745ff19a809cf1113a73e0e | |
parent | aa72d4ae8dfb626d21e36949e87f97cbe15ae832 (diff) |
feat(docs): add math katex support (#4972)
65 files changed, 190 insertions, 2 deletions
diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 7cb96d467ab..82cf9dc12e9 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -3,6 +3,8 @@ const lightCodeTheme = require("prism-react-renderer/themes/vsLight"); const darkCodeTheme = require("prism-react-renderer/themes/vsDark"); +const math = require("remark-math"); +const katex = require("rehype-katex"); /** @type {import('@docusaurus/types').Config} */ const config = { @@ -84,6 +86,8 @@ const config = { "https://github.com/OpenBB-finance/OpenBBTerminal/edit/main/website/", routeBasePath: "/", path: "content", + remarkPlugins: [math], + rehypePlugins: [katex], }, theme: { customCss: require.resolve("./src/css/custom.css"), @@ -113,6 +117,13 @@ const config = { contextualSearch: false, }, }), + + stylesheets: [ + { + href: "/katex/katex.min.css", + type: "text/css", + }, + ], }; module.exports = config; diff --git a/website/package-lock.json b/website/package-lock.json index 88b19c75067..18a45bd2fac 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -18,10 +18,13 @@ "@radix-ui/react-tooltip": "^1.0.5", "clsx": "^1.2.1", "fuse.js": "^6.6.2", + "hast-util-is-element": "^1.1.0", "posthog-js": "^1.53.4", "prism-react-renderer": "^1.3.5", "react": "^17.0.2", "react-dom": "^17.0.2", + "rehype-katex": "^5.0.0", + "remark-math": "^3.0.1", "tailwindcss-radix": "^2.7.0" }, "devDependencies": { @@ -3801,6 +3804,11 @@ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==" }, + "node_modules/@types/katex": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/@types/katex/-/katex-0.11.1.tgz", + "integrity": "sha512-DUlIj2nk0YnJdlWgsFuVKcX27MLW0KbKmGVoUHmFr+74FYYNUDAaj9ZqTADvsbE8rfxuVmSFc7KczYn5Y09ozg==" + }, "node_modules/@types/mdast": { "version": "3.0.10", "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.10.tgz", @@ -7191,6 +7199,15 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/hast-util-is-element": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/hast-util-is-element/-/hast-util-is-element-1.1.0.tgz", + "integrity": "sha512-oUmNua0bFbdrD/ELDSSEadRVtWZOf3iF6Lbv81naqsIV99RnSCieTbWuWCY8BAeEfKJTKl0gRdokv+dELutHGQ==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/hast-util-parse-selector": { "version": "2.2.5", "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-2.2.5.tgz", @@ -7242,6 +7259,20 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/hast-util-to-text": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/hast-util-to-text/-/hast-util-to-text-2.0.1.tgz", + "integrity": "sha512-8nsgCARfs6VkwH2jJU9b8LNTuR4700na+0h3PqCaEk4MAnMDeu5P0tP8mjk9LLNGxIeQRLbiDbZVw6rku+pYsQ==", + "dependencies": { + "hast-util-is-element": "^1.0.0", + "repeat-string": "^1.0.0", + "unist-util-find-after": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/hastscript": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/hastscript/-/hastscript-6.0.0.tgz", @@ -8091,6 +8122,29 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/katex": { + "version": "0.13.24", + "resolved": "https://registry.npmjs.org/katex/-/katex-0.13.24.tgz", + "integrity": "sha512-jZxYuKCma3VS5UuxOx/rFV1QyGSl3Uy/i0kTJF3HgQ5xMinCQVF8Zd4bMY/9aI9b9A2pjIBOsjSSm68ykTAr8w==", + "funding": [ + "https://opencollective.com/katex", + "https://github.com/sponsors/katex" + ], + "dependencies": { + "commander": "^8.0.0" + }, + "bin": { + "katex": "cli.js" + } + }, + "node_modules/katex/node_modules/commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "engines": { + "node": ">= 12" + } + }, "node_modules/keyv": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", @@ -10553,6 +10607,41 @@ "jsesc": "bin/jsesc" } }, + "node_modules/rehype-katex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/rehype-katex/-/rehype-katex-5.0.0.tgz", + "integrity": "sha512-ksSuEKCql/IiIadOHiKRMjypva9BLhuwQNascMqaoGLDVd0k2NlE2wMvgZ3rpItzRKCd6vs8s7MFbb8pcR0AEg==", + "dependencies": { + "@types/katex": "^0.11.0", + "hast-util-to-text": "^2.0.0", + "katex": "^0.13.0", + "rehype-parse": "^7.0.0", + "unified": "^9.0.0", + "unist-util-visit": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/rehype-parse": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/rehype-parse/-/rehype-parse-7.0.1.tgz", + "integrity": "sha512-fOiR9a9xH+Le19i4fGzIEowAbwG7idy2Jzs4mOrFWBSJ0sNUgy0ev871dwWnbOo371SjgjG4pwzrbgSVrKxecw==", + "dependencies": { + "hast-util-from-parse5": "^6.0.0", + "parse5": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/rehype-parse/node_modules/parse5": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", + "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==" + }, "node_modules/relateurl": { "version": "0.2.7", "resolved": "https://registry.npmjs.org/relateurl/-/relateurl-0.2.7.tgz", @@ -10580,6 +10669,15 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/remark-math": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/remark-math/-/remark-math-3.0.1.tgz", + "integrity": "sha512-epT77R/HK0x7NqrWHdSV75uNLwn8g9qTyMqCRCDujL0vj/6T6+yhdrR7mjELWtkse+Fw02kijAaBuVcHBor1+Q==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/remark-mdx": { "version": "1.6.22", "resolved": "https://registry.npmjs.org/remark-mdx/-/remark-mdx-1.6.22.tgz", @@ -12265,6 +12363,18 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/unist-util-find-after": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/unist-util-find-after/-/unist-util-find-after-3.0.0.tgz", + "integrity": "sha512-ojlBqfsBftYXExNu3+hHLfJQ/X1jYY/9vdm4yZWjIbf0VuWF6CRufci1ZyoD/wV2TYMKxXUoNuoqwy+CkgzAiQ==", + "dependencies": { + "unist-util-is": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/unist-util-generated": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/unist-util-generated/-/unist-util-generated-1.1.6.tgz", diff --git a/website/package.json b/website/package.json index df6dc4fae1b..4aca5bdd417 100644 --- a/website/package.json +++ b/website/package.json @@ -26,10 +26,13 @@ "@radix-ui/react-tooltip": "^1.0.5", "clsx": "^1.2.1", "fuse.js": "^6.6.2", + "hast-util-is-element": "^1.1.0", "posthog-js": "^1.53.4", "prism-react-renderer": "^1.3.5", "react": "^17.0.2", "react-dom": "^17.0.2", + "rehype-katex": "^5.0.0", + "remark-math": "^3.0.1", "tailwindcss-radix": "^2.7.0" }, "devDependencies": { diff --git a/website/static/katex/fonts/KaTeX_AMS-Regular.ttf b/website/static/katex/fonts/KaTeX_AMS-Regular.ttf Binary files differnew file mode 100644 index 00000000000..c6f9a5e7c03 --- /dev/null +++ b/website/static/katex/fonts/KaTeX_AMS-Regular.ttf diff --git a/website/static/katex/fonts/KaTeX_AMS-Regular.woff b/website/static/katex/fonts/KaTeX_AMS-Regular.woff Binary files differnew file mode 100644 index 00000000000..b804d7b33a3 --- /dev/null +++ b/website/static/katex/fonts/KaTeX_AMS-Regular.woff diff --git a/website/static/katex/fonts/KaTeX_AMS-Regular.woff2 b/website/static/katex/fonts/KaTeX_AMS-Regular.woff2 Binary files differnew file mode 100644 index 00000000000..0acaaff03d4 --- /dev/null +++ b/website/static/katex/fonts/KaTeX_AMS-Regular.woff2 diff --git a/website/static/katex/fonts/KaTeX_Caligraphic-Bold.ttf b/website/static/katex/fonts/KaTeX_Caligraphic-Bold.ttf Binary files differnew file mode 100644 index 00000000000..9ff4a5e0442 --- /dev/null +++ b/website/static/katex/fonts/KaTeX_Caligraphic-Bold.ttf diff --git a/website/static/katex/fonts/KaTeX_Caligraphic-Bold.woff b/website/static/katex/fonts/KaTeX_Caligraphic-Bold.woff Binary files differnew file mode 100644 index 00000000000..9759710d1d3 --- /dev/null +++ b/website/static/katex/fonts/KaTeX_Caligraphic-Bold.woff diff --git a/website/static/katex/fonts/KaTeX_Caligraphic-Bold.woff2 b/website/static/katex/fonts/KaTeX_Caligraphic-Bold.woff2 Binary files differnew file mode 100644 index 00000000000..f390922ecef --- /dev/null +++ b/website/static/katex/fonts/KaTeX_Caligraphic-Bold.woff2 diff --git a/website/static/katex/fonts/KaTeX_Caligraphic-Regular.ttf b/website/static/katex/fonts/KaTeX_Caligraphic-Regular.ttf Binary files differnew file mode 100644 index 00000000000..f522294ff0f --- /dev/null +++ b/website/static/katex/fonts/KaTeX_Caligraphic-Regular.ttf diff --git a/website/static/katex/fonts/KaTeX_Caligraphic-Regular.woff b/website/static/katex/fonts/KaTeX_Caligraphic-Regular.woff Binary files differnew file mode 100644 index 00000000000..9bdd534fd2b --- /dev/null +++ b/website/static/katex/fonts/KaTeX_Caligraphic-Regular.woff diff --git a/website/static/katex/fonts/KaTeX_Caligraphic-Regular.woff2 b/website/static/katex/fonts/KaTeX_Caligraphic-Regular.woff2 Binary files differnew file mode 100644 index 00000000000..75344a1f98e --- /dev/null +++ b/website/static/katex/fonts/KaTeX_Caligraphic-Regular.woff2 diff --git a/website/static/katex/fonts/KaTeX_Fraktur-Bold.ttf b/website/static/katex/fonts/KaTeX_Fraktur-Bold.ttf Binary files differnew file mode 100644 index 00000000000..4e98259c3b5 --- /dev/null +++ b/website/static/katex/fonts/KaTeX_Fraktur-Bold.ttf diff --git a/website/static/katex/fonts/KaTeX_Fraktur-Bold.woff b/website/static/katex/fonts/KaTeX_Fraktur-Bold.woff Binary files differnew file mode 100644 index 00000000000..e7730f66275 --- /dev/null +++ b/website/static/katex/fonts/KaTeX_Fraktur-Bold.woff diff --git a/website/static/katex/fonts/KaTeX_Fraktur-Bold.woff2 b/website/static/katex/fonts/KaTeX_Fraktur-Bold.woff2 Binary files differnew file mode 100644 index 00000000000..395f28beac2 --- /dev/null +++ b/website/static/katex/fonts/KaTeX_Fraktur-Bold.woff2 diff --git a/website/static/katex/fonts/KaTeX_Fraktur-Regular.ttf b/website/static/katex/fonts/KaTeX_Fraktur-Regular.ttf Binary files differnew file mode 100644 index 00000000000..b8461b275fa --- /dev/null +++ b/website/static/katex/fonts/KaTeX_Fraktur-Regular.ttf diff --git a/website/static/katex/fonts/KaTeX_Fraktur-Regular.woff b/website/static/katex/fonts/KaTeX_Fraktur-Regular.woff Binary files differnew file mode 100644 index 00000000000..acab069f90b --- /dev/null +++ b/website/static/katex/fonts/KaTeX_Fraktur-Regular.woff diff --git a/website/static/katex/fonts/KaTeX_Fraktur-Regular.woff2 b/website/static/katex/fonts/KaTeX_Fraktur-Regular.woff2 Binary files differnew file mode 100644 index 00000000000..735f6948d63 --- /dev/null +++ b/website/static/katex/fonts/KaTeX_Fraktur-Regular.woff2 diff --git a/website/static/katex/fonts/KaTeX_Main-Bold.ttf b/website/static/katex/fonts/KaTeX_Main-Bold.ttf Binary files differnew file mode 100644 index 00000000000..4060e627dc3 --- /dev/null +++ b/website/static/katex/fonts/KaTeX_Main-Bold.ttf diff --git a/website/static/katex/fonts/KaTeX_Main-Bold.woff b/website/static/katex/fonts/KaTeX_Main-Bold.woff Binary files differnew file mode 100644 index 00000000000..f38136ac1cc --- /dev/null +++ b/website/static/katex/fonts/KaTeX_Main-Bold.woff diff --git a/website/static/katex/fonts/KaTeX_Main-Bold.woff2 b/website/static/katex/fonts/KaTeX_Main-Bold.woff2 Binary files differnew file mode 100644 index 00000000000..ab2ad21da6f --- /dev/null +++ b/website/static/katex/fonts/KaTeX_Main-Bold.woff2 diff --git a/website/static/katex/fonts/KaTeX_Main-BoldItalic.ttf b/website/static/katex/fonts/KaTeX_Main-BoldItalic.ttf Binary files differnew file mode 100644 index 00000000000..dc007977ee7 --- /dev/null +++ b/website/static/katex/fonts/KaTeX_Main-BoldItalic.ttf diff --git a/website/static/katex/fonts/KaTeX_Main-BoldItalic.woff b/website/static/katex/fonts/KaTeX_Main-BoldItalic.woff Binary files differnew file mode 100644 index 00000000000..67807b0bd4f --- /dev/null +++ b/website/static/katex/fonts/KaTeX_Main-BoldItalic.woff diff --git a/website/static/katex/fonts/KaTeX_Main-BoldItalic.woff2 b/website/static/katex/fonts/KaTeX_Main-BoldItalic.woff2 Binary files differnew file mode 100644 index 00000000000..5931794de4a --- /dev/null +++ b/website/static/katex/fonts/KaTeX_Main-BoldItalic.woff2 diff --git a/website/static/katex/fonts/KaTeX_Main-Italic.ttf b/website/static/katex/fonts/KaTeX_Main-Italic.ttf Binary files differnew file mode 100644 index 00000000000..0e9b0f354ad --- /dev/null +++ b/website/static/katex/fonts/KaTeX_Main-Italic.ttf diff --git a/website/static/katex/fonts/KaTeX_Main-Italic.woff b/website/static/katex/fonts/KaTeX_Main-Italic.woff Binary files differnew file mode 100644 index 00000000000..6f43b594b6c --- /dev/null +++ b/website/static/katex/fonts/KaTeX_Main-Italic.woff diff --git a/website/static/katex/fonts/KaTeX_Main-Italic.woff2 b/website/static/katex/fonts/KaTeX_Main-Italic.woff2 Binary files differnew file mode 100644 index 00000000000..b50920e1388 --- /dev/null +++ b/website/static/katex/fonts/KaTeX_Main-Italic.woff2 diff --git a/website/static/katex/fonts/KaTeX_Main-Regular.ttf b/website/static/katex/fonts/KaTeX_Main-Regular.ttf Binary files differnew file mode 100644 index 00000000000..dd45e1ed2e1 --- /dev/null +++ b/website/static/katex/fonts/KaTeX_Main-Regular.ttf diff --git a/website/static/katex/fonts/KaTeX_Main-Regular.woff b/website/static/katex/fonts/KaTeX_Main-Regular.woff Binary files differnew file mode 100644 index 00000000000..21f5812968c --- /dev/null +++ b/website/static/katex/fonts/KaTeX_Main-Regular.woff diff --git a/website/static/katex/fonts/KaTeX_Main-Regular.woff2 b/website/static/katex/fonts/KaTeX_Main-Regular.woff2 Binary files differnew file mode 100644 index 00000000000..eb24a7ba282 --- /dev/null +++ b/website/static/katex/fonts/KaTeX_Main-Regular.woff2 diff --git a/website/static/katex/fonts/KaTeX_Math-BoldItalic.ttf b/website/static/katex/fonts/KaTeX_Math-BoldItalic.ttf Binary files differnew file mode 100644 index 00000000000..728ce7a1e2c --- /dev/null +++ b/website/static/katex/fonts/KaTeX_Math-BoldItalic.ttf diff --git a/website/static/katex/fonts/KaTeX_Math-BoldItalic.woff b/website |