Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@zeit/react-jsx-parser": "^2.0.0",
"github-slugger": "^1.4",
"highlight.js": "^11.2",
"katex": "^0.15.3",
"next": "^12",
"nprogress": "^0.2.0",
"react": "^17",
Expand Down
Binary file added public/fonts/KaTeX_AMS-Regular.ttf
Binary file not shown.
Binary file added public/fonts/KaTeX_AMS-Regular.woff
Binary file not shown.
Binary file added public/fonts/KaTeX_AMS-Regular.woff2
Binary file not shown.
Binary file added public/fonts/KaTeX_Caligraphic-Bold.ttf
Binary file not shown.
Binary file added public/fonts/KaTeX_Caligraphic-Bold.woff
Binary file not shown.
Binary file added public/fonts/KaTeX_Caligraphic-Bold.woff2
Binary file not shown.
Binary file added public/fonts/KaTeX_Caligraphic-Regular.ttf
Binary file not shown.
Binary file added public/fonts/KaTeX_Caligraphic-Regular.woff
Binary file not shown.
Binary file added public/fonts/KaTeX_Caligraphic-Regular.woff2
Binary file not shown.
Binary file added public/fonts/KaTeX_Fraktur-Bold.ttf
Binary file not shown.
Binary file added public/fonts/KaTeX_Fraktur-Bold.woff
Binary file not shown.
Binary file added public/fonts/KaTeX_Fraktur-Bold.woff2
Binary file not shown.
Binary file added public/fonts/KaTeX_Fraktur-Regular.ttf
Binary file not shown.
Binary file added public/fonts/KaTeX_Fraktur-Regular.woff
Binary file not shown.
Binary file added public/fonts/KaTeX_Fraktur-Regular.woff2
Binary file not shown.
Binary file added public/fonts/KaTeX_Main-Bold.ttf
Binary file not shown.
Binary file added public/fonts/KaTeX_Main-Bold.woff
Binary file not shown.
Binary file added public/fonts/KaTeX_Main-Bold.woff2
Binary file not shown.
Binary file added public/fonts/KaTeX_Main-BoldItalic.ttf
Binary file not shown.
Binary file added public/fonts/KaTeX_Main-BoldItalic.woff
Binary file not shown.
Binary file added public/fonts/KaTeX_Main-BoldItalic.woff2
Binary file not shown.
Binary file added public/fonts/KaTeX_Main-Italic.ttf
Binary file not shown.
Binary file added public/fonts/KaTeX_Main-Italic.woff
Binary file not shown.
Binary file added public/fonts/KaTeX_Main-Italic.woff2
Binary file not shown.
Binary file added public/fonts/KaTeX_Main-Regular.ttf
Binary file not shown.
Binary file added public/fonts/KaTeX_Main-Regular.woff
Binary file not shown.
Binary file added public/fonts/KaTeX_Main-Regular.woff2
Binary file not shown.
Binary file added public/fonts/KaTeX_Math-BoldItalic.ttf
Binary file not shown.
Binary file added public/fonts/KaTeX_Math-BoldItalic.woff
Binary file not shown.
Binary file added public/fonts/KaTeX_Math-BoldItalic.woff2
Binary file not shown.
Binary file added public/fonts/KaTeX_Math-Italic.ttf
Binary file not shown.
Binary file added public/fonts/KaTeX_Math-Italic.woff
Binary file not shown.
Binary file added public/fonts/KaTeX_Math-Italic.woff2
Binary file not shown.
Binary file added public/fonts/KaTeX_SansSerif-Bold.ttf
Binary file not shown.
Binary file added public/fonts/KaTeX_SansSerif-Bold.woff
Binary file not shown.
Binary file added public/fonts/KaTeX_SansSerif-Bold.woff2
Binary file not shown.
Binary file added public/fonts/KaTeX_SansSerif-Italic.ttf
Binary file not shown.
Binary file added public/fonts/KaTeX_SansSerif-Italic.woff
Binary file not shown.
Binary file added public/fonts/KaTeX_SansSerif-Italic.woff2
Binary file not shown.
Binary file added public/fonts/KaTeX_SansSerif-Regular.ttf
Binary file not shown.
Binary file added public/fonts/KaTeX_SansSerif-Regular.woff
Binary file not shown.
Binary file added public/fonts/KaTeX_SansSerif-Regular.woff2
Binary file not shown.
Binary file added public/fonts/KaTeX_Script-Regular.ttf
Binary file not shown.
Binary file added public/fonts/KaTeX_Script-Regular.woff
Binary file not shown.
Binary file added public/fonts/KaTeX_Script-Regular.woff2
Binary file not shown.
Binary file added public/fonts/KaTeX_Size1-Regular.ttf
Binary file not shown.
Binary file added public/fonts/KaTeX_Size1-Regular.woff
Binary file not shown.
Binary file added public/fonts/KaTeX_Size1-Regular.woff2
Binary file not shown.
Binary file added public/fonts/KaTeX_Size2-Regular.ttf
Binary file not shown.
Binary file added public/fonts/KaTeX_Size2-Regular.woff
Binary file not shown.
Binary file added public/fonts/KaTeX_Size2-Regular.woff2
Binary file not shown.
Binary file added public/fonts/KaTeX_Size3-Regular.ttf
Binary file not shown.
Binary file added public/fonts/KaTeX_Size3-Regular.woff
Binary file not shown.
Binary file added public/fonts/KaTeX_Size3-Regular.woff2
Binary file not shown.
Binary file added public/fonts/KaTeX_Size4-Regular.ttf
Binary file not shown.
Binary file added public/fonts/KaTeX_Size4-Regular.woff
Binary file not shown.
Binary file added public/fonts/KaTeX_Size4-Regular.woff2
Binary file not shown.
Binary file added public/fonts/KaTeX_Typewriter-Regular.ttf
Binary file not shown.
Binary file added public/fonts/KaTeX_Typewriter-Regular.woff
Binary file not shown.
Binary file added public/fonts/KaTeX_Typewriter-Regular.woff2
Binary file not shown.
1 change: 1 addition & 0 deletions public/katex.min-v0.15.3.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/components/head.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const BlogHead = ({
href="/favicon-16x16.png"
/>
<link rel="stylesheet" type="text/css" href="/nprogress.css" />
<link rel="stylesheet" type="text/css" href="/katex.min-v0.15.3.css" />
<link
rel="preload"
href="/fonts/ibm-plex-serif-v8-latin-regular.woff2"
Expand Down
12 changes: 12 additions & 0 deletions src/pages/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
import RichTextSpan from 'src/components/rich-text'
import Code from 'src/components/code'
import blogConfig from 'blog.config'
import katex from 'katex'

type Props = {
post: BlogPost
Expand Down Expand Up @@ -302,6 +303,17 @@ function getElements(blocks, level = 0): JSX.Element[] {
</div>
)
break
case 'equation':
elements.push(
<div key={block.id} style={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you create a .equation class inside of blog.module.css which contains these CSS declarations?

dangerouslySetInnerHTML={{
__html: katex.renderToString(block.equation.expression, {
throwOnError: false

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you find that this code would often throw exceptions? I'm not sure if it's better to create an error on invalid equation content, or to ignore it and keep going.

})
}}
/>
)
break
case 'column':
throw new Error(
`'column' type found in elements list, which should not happen.`
Expand Down
9 changes: 8 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ combined-stream@^1.0.8:
dependencies:
delayed-stream "~1.0.0"

commander@^8.2.0:
commander@^8.0.0, commander@^8.2.0:
version "8.3.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66"
integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==
Expand Down Expand Up @@ -1565,6 +1565,13 @@ json5@^1.0.1:
dependencies:
minimist "^1.2.0"

katex@^0.15.3:
version "0.15.3"
resolved "https://registry.yarnpkg.com/katex/-/katex-0.15.3.tgz#08781a7ed26800b20380d959d1ffcd62bca0ec14"
integrity sha512-Al6V7RJsmjklT9QItyHWGaQCt+NYTle1bZwB1e9MR/tLoIT1MXaHy9UpfGSB7eaqDgjjqqRxQOaQGrALCrEyBQ==
dependencies:
commander "^8.0.0"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer not to downgrade a dependency just because a new dependency needs an older version. Is this absolutely required for katex to function? It seems a bit strange for a CLI argument parser library to be required when we're not using the CLI explicitly.


lines-and-columns@^1.1.6:
version "1.1.6"
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00"
Expand Down