Skip to content

Commit

Permalink
add cs231n_notes
Browse files Browse the repository at this point in the history
  • Loading branch information
WncFht committed Dec 4, 2024
1 parent 2fbae33 commit aaff1fc
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 45 deletions.
49 changes: 10 additions & 39 deletions docs/js/katex.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,10 @@
(function () {
'use strict';

var katexMath = (function () {
var maths = document.querySelectorAll('.arithmatex'),
tex;

for (var i = 0; i < maths.length; i++) {
tex = maths[i].textContent || maths[i].innerText;
if (tex.startsWith('\\(') && tex.endsWith('\\)')) {
katex.render(tex.slice(2, -2), maths[i], {'displayMode': false});
} else if (tex.startsWith('\\[') && tex.endsWith('\\]')) {
katex.render(tex.slice(2, -2), maths[i], {'displayMode': true});
}
}
});

(function () {
var onReady = function onReady(fn) {
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", fn);
} else {
document.attachEvent("onreadystatechange", function () {
if (document.readyState === "interactive") {
fn();
}
});
}
};

onReady(function () {
if (typeof katex !== "undefined") {
katexMath();
}
});
})();

}());

document$.subscribe(({ body }) => {
renderMathInElement(body, {
delimiters: [
{ left: "$$", right: "$$", display: true }, // Display mode equations
{ left: "$", right: "$", display: false }, // Inline equations
{ left: "\\(", right: "\\)", display: false }, // Alternative inline
{ left: "\\[", right: "\\]", display: true } // Alternative display
],
})
})
16 changes: 16 additions & 0 deletions docs/js/mathjax.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
window.MathJax = {
tex: {
inlineMath: [["\\(", "\\)"]], // Inline math delimiters
displayMath: [["\\[", "\\]"]], // Display math delimiters
processEscapes: true, // Handle escaped characters
processEnvironments: true // Process LaTeX environments
},
options: {
ignoreHtmlClass: ".*|", // Ignore all classes by default
processHtmlClass: "arithmatex" // Only process elements with this class
}
};

document$.subscribe(() => {
MathJax.typesetPromise() // Render math when document loads
})
20 changes: 14 additions & 6 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ markdown_extensions:
custom_checkbox: true
- pymdownx.arithmatex:
generic: true


# - markdown.extensions.toc:
# slugify:
# !!python/object/apply:pymdownx.slugs.slugify { kwds: { case: lower } }
Expand Down Expand Up @@ -141,8 +143,8 @@ extra:
# property: YOUR-ANALYTICS-ID

extra_css:
# - https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.7/katex.min.css
- https://cdn.tonycrane.cc/utils/katex.min.css
- https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/katex.min.css
# - https://cdn.tonycrane.cc/utils/katex.min.css
- https://cdn.tonycrane.cc/jbmono/jetbrainsmono.css
- https://cdn.tonycrane.cc/lxgw/lxgwscreen.css
- css/custom.css
Expand All @@ -153,17 +155,23 @@ extra_css:
# - css/changelog_extra.css
# - css/flod_toc.css
# - css/grid cards.css # 好用的但还没用
# - https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/katex.min.css
# - css/extra.css
# - https://cdn.jsdelivr.net/npm/[email protected]/style.css


extra_javascript:
- js/katex.js
- https://cdn.tonycrane.cc/utils/katex.min.js
- js/mathjax.js
# - https://cdn.tonycrane.cc/utils/katex.min.js
- https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js
# - https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.7/katex.min.js
# - https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.7/contrib/auto-render.min.js
# katex
- https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/katex.min.js
- https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.9/contrib/auto-render.min.js
# mathjax
- https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.0/es5/tex-mml-chtml.js
- https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.0/es5/tex-chtml.js
- https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.0/es5/tex-chtml-full.js
- https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.0/es5/tex-svg-full.js
# - js/custom.js
# - js/heti.js
# - js/toc.js
Expand Down

0 comments on commit aaff1fc

Please sign in to comment.