forked from mirrors/hugo-tufte
fix katex, 1 new shortcode, various fixes
This commit is contained in:
parent
e6c63a59cb
commit
e6d583a987
9 changed files with 90 additions and 46 deletions
assets
22
assets/latex-fix.js
Normal file
22
assets/latex-fix.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
(function() {
|
||||
var i, text, code, codes = document.getElementsByTagName('code');
|
||||
for (i = 0; i < codes.length;) {
|
||||
code = codes[i];
|
||||
if (code.parentNode.tagName !== 'PRE' && code.childElementCount === 0 && !(code.classList.contains("nolatex")) ) {
|
||||
text = code.textContent;
|
||||
if (/^\$[^$]/.test(text) && /[^$]\$$/.test(text)) {
|
||||
text = text.replace(/^\$/, '\\(').replace(/\$$/, '\\)');
|
||||
code.textContent = text;
|
||||
}
|
||||
if (/^\\\((.|\s)+\\\)$/.test(text) || /^\\\[(.|\s)+\\\]$/.test(text) ||
|
||||
/^\$(.|\s)+\$$/.test(text) ||
|
||||
/^\\begin\{([^}]+)\}(.|\s)+\\end\{[^}]+\}$/.test(text)) {
|
||||
code.outerHTML = code.innerHTML; // remove <code></code>
|
||||
continue;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
})();
|
||||
|
||||
// https://yihui.org/en/2018/07/latex-math-markdown/
|
|
@ -21,8 +21,7 @@ article,
|
|||
header,
|
||||
footer,
|
||||
.pure-g [class*="pure-u"] {
|
||||
font-family: "et-book", -apple-system, "San Francisco", "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell",
|
||||
"Open Sans", "Helvetica Neue", "Lucida Grand", sans-serif;
|
||||
font-family: et-book, "Noto Serif SC", Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
|
||||
}
|
||||
|
||||
p {
|
||||
|
|
2
assets/scss/vendor/tufte.scss
vendored
2
assets/scss/vendor/tufte.scss
vendored
|
@ -64,7 +64,7 @@ body {
|
|||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
padding-left: 12.5%;
|
||||
font-family: et-book, Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
|
||||
font-family: et-book, "Noto Serif SC", Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
|
||||
background-color: #fffff8;
|
||||
color: #111;
|
||||
max-width: 1400px;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue