diff --git a/assets/latex-fix.js b/assets/latex-fix.js new file mode 100644 index 0000000..2b10161 --- /dev/null +++ b/assets/latex-fix.js @@ -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 + continue; + } + } + i++; + } +})(); + +// https://yihui.org/en/2018/07/latex-math-markdown/ diff --git a/assets/scss/general.scss b/assets/scss/general.scss index b30103c..f35e432 100644 --- a/assets/scss/general.scss +++ b/assets/scss/general.scss @@ -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 { diff --git a/assets/scss/vendor/tufte.scss b/assets/scss/vendor/tufte.scss index 8df7479..6e2bf11 100644 --- a/assets/scss/vendor/tufte.scss +++ b/assets/scss/vendor/tufte.scss @@ -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; diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 4cb5269..42d6304 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,9 +1,15 @@ - {{- partial "header.html" . -}} +{{- partial "header.html" . -}} - - {{ block "main" . }}{{ end }} - + +{{ block "main" . }}{{ end }} - \ No newline at end of file + +{{ if or .Params.math .IsHome }} +{{ partial "math.html" . }} +{{ end }} + + + + diff --git a/layouts/partials/header.includes.html b/layouts/partials/header.includes.html index d72adab..9d64511 100644 --- a/layouts/partials/header.includes.html +++ b/layouts/partials/header.includes.html @@ -1,8 +1,3 @@ - -{{ if or .Params.math .IsHome }} - {{ partial "math.html" . }} -{{ end }} - @@ -12,6 +7,19 @@ + + + + + + + @@ -20,5 +28,3 @@ - - diff --git a/layouts/partials/math.html b/layouts/partials/math.html index 60366bf..0e4c810 100644 --- a/layouts/partials/math.html +++ b/layouts/partials/math.html @@ -1,29 +1,28 @@ -{{ if .Params.katex }} - - - - +{{ end }} + + + + + + -{{ else }} - - - -{{ end }} \ No newline at end of file + }); + }); + diff --git a/layouts/shortcodes/blockquote.html b/layouts/shortcodes/blockquote.html index 16f78fc..8217018 100644 --- a/layouts/shortcodes/blockquote.html +++ b/layouts/shortcodes/blockquote.html @@ -2,5 +2,5 @@

{{ .Inner | markdownify }}

- - \ No newline at end of file + + diff --git a/layouts/shortcodes/cols.html b/layouts/shortcodes/cols.html new file mode 100644 index 0000000..67745cb --- /dev/null +++ b/layouts/shortcodes/cols.html @@ -0,0 +1,12 @@ +{{ $cols := split .Inner "||" }} + +{{ $lang := .Get "lang" | default ( .Get 0 ) }} +{{ $lang := split $lang "," }} + + +{{ range $indCol,$col := $cols }} + + {{ . | $.Page.RenderString (dict "display" "block") }} + +{{ end }} + diff --git a/layouts/shortcodes/epigraph.html b/layouts/shortcodes/epigraph.html index b991f27..d8fa762 100644 --- a/layouts/shortcodes/epigraph.html +++ b/layouts/shortcodes/epigraph.html @@ -11,5 +11,5 @@ {{ with .Get "post" }}{{ . }}{{ end }} {{ end }} -
+