Skip to content

Commit 9825f1c

Browse files
committed
MathJax: enable via kramdown + layout scripts; add Codex page and nav; add math overflow CSS
1 parent 1d34132 commit 9825f1c

File tree

7 files changed

+30
-0
lines changed

7 files changed

+30
-0
lines changed

Eye of the Cosmos.png

1.8 MB
Loading

_config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ incremental: false
6161
# Markdown Processing
6262
kramdown:
6363
input: GFM
64+
math_engine: mathjax
65+
math_engine_opts: {}
6466
hard_wrap: false
6567
auto_ids: true
6668
footnote_nr: 1

_data/navigation.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ main:
33
url: /blog/
44
- title: "Projects"
55
url: /projects/
6+
- title: "Codex"
7+
url: /codex/
68
- title: "About"
79
url: /about/

_layouts/default.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
{% if site.tags != "" %}
2828
{% include collecttags.html %}
2929
{% endif %}
30+
31+
<!-- MathJax v3 -->
32+
<script src="{{ '/assets/js/mathjax-config.js' | relative_url }}"></script>
33+
<script async id="MathJax-script" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
3034
</head>
3135

3236
<body class="layout--{{ page.layout | default: layout.layout }}{% if page.classes or layout.classes %}{{ page.classes | default: layout.classes | join: ' ' | prepend: ' ' }}{% endif %}">

_pages/codex.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
layout: page
3+
title: Codex
4+
permalink: /codex/
5+
---
6+

assets/css/main.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,9 @@ $susy: (
4444
@import "slimmenu";
4545
@import "post";
4646
@import "page";
47+
48+
/* Avoid horizontal overflow for math renderers */
49+
.katex-display, .MathJax, .mjx-container {
50+
overflow-x: auto;
51+
overflow-y: hidden;
52+
}

assets/js/mathjax-config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
window.MathJax = {
2+
tex: {
3+
inlineMath: [['$', '$'], ['\\(', '\\)']],
4+
displayMath: [['$$', '$$'], ['\\[', '\\]']],
5+
processEscapes: true
6+
},
7+
options: {
8+
skipHtmlTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
9+
}
10+
};

0 commit comments

Comments
 (0)