-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[skip ci] wip - fixing math rendering in documentation - almost there
- Loading branch information
1 parent
c16e7ff
commit 2d3951a
Showing
42 changed files
with
326 additions
and
297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,3 +152,4 @@ package-lock.json | |
node_modules/ | ||
|
||
docs/api | ||
docs/examples/*.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,26 @@ | ||
(function () { | ||
'use strict'; | ||
document$.subscribe(({ body }) => { | ||
renderMathInElement(body, { | ||
delimiters: [ | ||
{ left: "$$", right: "$$", display: true }, | ||
{ left: "$", right: "$", display: false }, | ||
{ left: "\\(", right: "\\)", display: false }, | ||
{ left: "\\[", right: "\\]", display: true } | ||
], | ||
}) | ||
}) | ||
|
||
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.addEventListener("DOMContentLoaded", function() { | ||
// renderMathInElement(document.body, { | ||
// // customised options | ||
// // • auto-render specific keys, e.g.: | ||
// delimiters: [ | ||
// {left: '$$', right: '$$', display: true}, | ||
// {left: '$', right: '$', display: false}, | ||
// {left: '\\(', right: '\\)', display: false}, | ||
// {left: '\\[', right: '\\]', display: true} | ||
// ], | ||
// // • rendering keys, e.g.: | ||
// throwOnError : false | ||
// }) | ||
// }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from pathlib import Path | ||
import subprocess | ||
|
||
EXECUTE = False | ||
EXCLUDE = ["docs/examples/utils.py"] | ||
ALLOW_ERRORS = False | ||
|
||
|
||
for file in Path("docs/").glob("examples/*.py"): | ||
if file.as_posix() in EXCLUDE: | ||
continue | ||
|
||
out_file = file.with_suffix(".md") | ||
|
||
command = "jupytext --to markdown " | ||
command += f"{'--execute ' if EXECUTE else ''}" | ||
command += f"{'--allow-errors ' if ALLOW_ERRORS else ''}" | ||
command += f"{file} --output {out_file}" | ||
|
||
subprocess.run(command, shell=True, check=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.