Skip to content

Commit 16b74eb

Browse files
committed
Enable math formulas in blog posts
Signed-off-by: Sergey Fedorov <[email protected]>
1 parent 6121077 commit 16b74eb

File tree

3 files changed

+287
-2
lines changed

3 files changed

+287
-2
lines changed

docusaurus.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
import { themes as prismThemes } from 'prism-react-renderer';
55

6+
import remarkMath from 'remark-math';
7+
import rehypeKatex from 'rehype-katex';
8+
69
const lightCodeTheme = prismThemes.github;
710
const darkCodeTheme = prismThemes.dracula;
811

@@ -73,6 +76,8 @@ const config = {
7376
onInlineAuthors: 'throw',
7477
// Remove this to remove the "edit this page" links.
7578
editUrl: `${siteGitHubUrl}/edit/main/`,
79+
remarkPlugins: [remarkMath],
80+
rehypePlugins: [rehypeKatex],
7681
},
7782
]
7883
],
@@ -101,6 +106,16 @@ const config = {
101106
],
102107
],
103108

109+
stylesheets: [
110+
{
111+
href: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css',
112+
type: 'text/css',
113+
integrity:
114+
'sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM',
115+
crossorigin: 'anonymous',
116+
},
117+
],
118+
104119
themeConfig:
105120
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
106121
({

package-lock.json

Lines changed: 269 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)