Skip to content

Commit

Permalink
feat: support katex
Browse files Browse the repository at this point in the history
  • Loading branch information
jctaoo committed Jul 26, 2021
1 parent 916d4ac commit 575e1e2
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 36 deletions.
10 changes: 10 additions & 0 deletions content/posts/HelloWorld.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ topImageAlt: "Hello World"

# "Hello, World!" program


$$
\begin{aligned}
\dot{x} & = \sigma(y-x) \\
\dot{y} & = \rho x - y - xz \\
\dot{z} & = -\beta z + xy
\end{aligned}
$$


> from [wikipedia](https://en.wikipedia.org/wiki/%22Hello,_World!%22_program)
"Hello World" redirects here. For other uses, see Hello World (disambiguation).
Expand Down
2 changes: 2 additions & 0 deletions gatsby-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import "./src/styles/index.scss";
import "./src/styles/base.scss";
import store, { Actions } from "./src/state";

import "katex/dist/katex.min.css";

import dayjs from "dayjs";
import duration from "dayjs/plugin/duration";
dayjs.extend(duration);
Expand Down
7 changes: 7 additions & 0 deletions gatsby-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,13 @@ export default {
escapeEntities: {},
},
},
{
resolve: `gatsby-remark-katex`,
options: {
// Add any KaTeX options from https://github.com/KaTeX/KaTeX/blob/master/docs/options.md here
strict: `ignore`
}
}
],
},
},
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
"gatsby-plugin-sass": "^4.2.0",
"gatsby-plugin-sharp": "^3.10.2",
"gatsby-remark-images": "^5.7.0",
"gatsby-remark-katex": "^5.7.0",
"gatsby-remark-prismjs": "^5.7.0",
"gatsby-source-filesystem": "^3.9.0",
"gatsby-transformer-remark": "^4.6.0",
"gatsby-transformer-remark": "^4.7.0",
"gatsby-transformer-sharp": "^3.10.0",
"highlight.js": "^10.7.2",
"jsdom": "^16.5.2",
"katex": "^0.13.0",
"katex": "^0.13.13",
"marked": "^2.0.1",
"prettier": "^2.2.1",
"prismjs": "^1.24.1",
Expand Down
120 changes: 88 additions & 32 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions src/styles/markdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,7 @@ $base-text-size: 16px;
}
}

// TODO: for LaTex
span.latex {
span.katex {
font-size: $base-text-size * 1.5;
display: block;
text-align: center;
Expand Down

0 comments on commit 575e1e2

Please sign in to comment.