fix math-katex rendering (#194)

* fix math-katex rendering

* enable singleDollarTextMath option with remarkMath

* dynamic import katex.css and add yarn.lock

---------

Co-authored-by: Jing Hua <tohjinghua123@gmail.com>
This commit is contained in:
Tindo N. Arsel 2023-04-07 14:13:46 +01:00 committed by GitHub
parent 96bf1c50fb
commit cc82f5b29d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 1 deletions

View file

@ -49,6 +49,7 @@
"i18next-browser-languagedetector": "^7.0.1", "i18next-browser-languagedetector": "^7.0.1",
"i18next-http-backend": "^2.1.1", "i18next-http-backend": "^2.1.1",
"jspdf": "^2.5.1", "jspdf": "^2.5.1",
"katex": "^0.16.4",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"match-sorter": "^6.3.1", "match-sorter": "^6.3.1",
"papaparse": "^5.4.1", "papaparse": "^5.4.1",

View file

@ -141,7 +141,7 @@ const ContentView = React.memo(
[remarkMath, { singleDollarTextMath: false }], [remarkMath, { singleDollarTextMath: false }],
]} ]}
rehypePlugins={[ rehypePlugins={[
[rehypeKatex, { output: 'mathml' }], rehypeKatex,
[ [
rehypeHighlight, rehypeHighlight,
{ {

View file

@ -2,6 +2,7 @@ import React from 'react';
import ReactDOM from 'react-dom/client'; import ReactDOM from 'react-dom/client';
import App from './App'; import App from './App';
import './main.css'; import './main.css';
await import('katex/dist/katex.min.css');
import './i18n'; import './i18n';

View file

@ -2314,6 +2314,13 @@ katex@^0.15.0:
dependencies: dependencies:
commander "^8.0.0" commander "^8.0.0"
katex@^0.16.4:
version "0.16.4"
resolved "https://registry.yarnpkg.com/katex/-/katex-0.16.4.tgz#87021bc3bbd80586ef715aeb476794cba6a49ad4"
integrity sha512-WudRKUj8yyBeVDI4aYMNxhx5Vhh2PjpzQw1GRu/LVGqL4m1AxwD1GcUp0IMbdJaf5zsjtj8ghP0DOQRYhroNkw==
dependencies:
commander "^8.0.0"
keyv@^4.0.0: keyv@^4.0.0:
version "4.5.2" version "4.5.2"
resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.2.tgz#0e310ce73bf7851ec702f2eaf46ec4e3805cce56" resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.2.tgz#0e310ce73bf7851ec702f2eaf46ec4e3805cce56"