Skip to content

Commit

Permalink
feat: update math engine
Browse files Browse the repository at this point in the history
  • Loading branch information
liuzhuan committed Nov 1, 2024
1 parent a739be1 commit 80f52ba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 30 deletions.
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ gem "minima", "~> 2.5"
# If you have any plugins, put them here!
group :jekyll_plugins do
gem "jekyll-feed", "~> 0.12"
gem "kramdown-math-katex"
end

# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
Expand Down
3 changes: 0 additions & 3 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ logo: /codeman.png

# Build settings
theme: minima
markdown: kramdown
kramdown:
math_engine: katex
plugins:
- jekyll-feed
# Exclude from processing.
Expand Down
34 changes: 8 additions & 26 deletions _posts/2017-12-08-hello-jekyll.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,38 +47,20 @@ sudo apt install jekyll
- [MathJax](https://www.mathjax.org/),排版质量高,符号全面
- [KaTeX](https://katex.org/),渲染速度快

以 KaTeX 为例。使用插件 [kramdown-math-katex](https://kramdown.gettalong.org/math_engine/katex.html) 可以在 Jekyll 中使用 KaTeX 渲染数学公式
GitHub 仅支持 MathJax

首先,将这个插件添加到 `Gemfile` 中:

```ruby
group :jekyll_plugins do
gem "kramdown-math-katex"
end
```

然后,执行 `bundle install` 安装依赖。

安装成功后,在 `_config.yml` 配置文件中启用插件:

```yml
markdown: kramdown
kramdown:
math_engine: katex
```
最后,在页面 `<head>` 中添加 CSS 样式文件:

```html
<link rel="stylesheet" href="https://unpkg.com/katex@0.16.11/dist/katex.min.css">
```

使用两个美元符号包裹公式。既可以使用内联公式,比如:$$2^3=8$$。也可以使用块级公式,比如:
使用两个美元符号包裹公式。既可以使用内联公式,比如:$2^3=8$。也可以使用块级公式,比如:

$$
\int_m^n{(a + b)}dt = c
$$

使用 `math` 代码块:

```math
\int_m^n{(a + b)}dt = c
```

## 网站地图

[jekyll-sitemap][sitemap] 可以自动创建网站地址。用法如下:
Expand Down

0 comments on commit 80f52ba

Please sign in to comment.