Skip to content

Instantly share code, notes, and snippets.

@mebiusbox
Last active February 29, 2024 21:23
Show Gist options
  • Save mebiusbox/b8f40ce99a88dc24a680c8e026a6e911 to your computer and use it in GitHub Desktop.
Save mebiusbox/b8f40ce99a88dc24a680c8e026a6e911 to your computer and use it in GitHub Desktop.
mdbook template

Math

Mathjax がサポートされている.

[output.html]
mathjax-support = true

ただ、デリミタが \\[,\\], \\(, \\) で使いづらい.さらに \\ はエスケープする必要がある. そして遅い.なので、KaTeX を使う mdbook-katex を使う. ただし、Windowsの場合はcargo経由でインストールするのではなく、GitHubからgnu版をインストールすることで全ての機能が利用できる.特に行列周りで問題があるので必ずダウンロードしたものを使う.mdbook-katex を有効にするには次のようにする.

[preprocessor.katex]
after = ["links"]

admonish

mdbook-admonish install でインストール

印刷 (PDF)

その他

[output.html]
additional-css = ['.\mdbook-custom.css', '.\mdbook-admonish.css']
default-theme = "light"
curly-quotes = true
html {
font-family: 'Iosevka Fixed', 'UD デジタル 教科書体 NK-R', 'Sarasa Fixed J Semibold';
}
body {
font-size: 2.0rem;
}
body {
/* background-color: #242424; */
}
.light {
}
.ayu {
--bg: #242424;
--fg: #fefefe;
--sidebar-bg: #242424;
--sidebar-fg: #fefefe;
--quote-bg: hsl(226, 15%, 30%);
--quote-border: hsl(226, 15%, 22%);
}
#content h1:before {
font-family: 'FontAwesome';
content: '\f02d';
font-weight: 900;
padding-right: 16px;
}
#content h2:before {
font-family: 'FontAwesome';
content: '\f138';
font-weight: 900;
padding-right: 12px;
}
.ayu #content h3 > a {
color: #ffcb08;
}
.ayu #content strong {
color: #ff5050;
}
.light #content h1:before {
color: rgb(53, 120, 246);
}
.light #content h2:before {
color: rgb(53, 120, 246);
}
.light #content h1 > a {
color: rgb(53, 120, 246);
}
.light #content h2 > a {
color: rgb(53, 120, 246);
}
.light #content h3 > a {
color: rgb(53, 120, 246);
}
.light #content strong {
color: rgb(53, 120, 246);
}
.ayu pre > code {
line-height: 1.75em;
border: 2px dashed #376092;
}
.ayu pre > code.hljs.language-shell {
background-color: #1e4676;
border: 2px solid #376092;
}
.ayu p > code.hljs {
background-color: #f0f0f0;
--inline-code-color: #222;
}
.light pre > code {
line-height: 1.75em;
border: 1px solid rgb(53, 120, 246);
}
.light pre > code.hljs.language-shell {
background-color: rgb(233, 239, 250);
border: 2px dashed rgb(53, 120, 246);
}
.light p > code.hljs {
background-color: #ddd;
--inline-code-color: #222;
padding: 2px 4px;
margin: 0px 4px;
}
pre code {
font-size: 0.8em;
font-family: "Iosevka Fixed Medium", "Iosevka Fixed", "Fira Mono", monospace !important;
}
p code {
font-family: "Iosevka Fixed Medium", "Sarasa Fixed J Semibold", "Fira Mono", monospace !important;
}
p img { display: block; margin: auto; }
div.admonition {
border: 1px solid #999;
}
@media print {
body {
font-size: 11pt;
}
h2, h3 {
margin-block-start: 2.0em;
}
.content img {
max-width: 75%;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment