-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: re-export
TransitionTable
s and GreedyTokenizer
, render mer…
…maid with mermaid.js (#30)
- Loading branch information
1 parent
c059267
commit 6189ab2
Showing
2 changed files
with
27 additions
and
2 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 |
---|---|---|
|
@@ -16,7 +16,26 @@ | |
integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" | ||
crossorigin="anonymous" | ||
></script> | ||
<script | ||
defer | ||
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.min.js" | ||
integrity="sha256-vaQqBFvghaWMX0hbXlHsEQCo9C1Xn8QsBGel6kT3X7E=" | ||
crossorigin="anonymous" | ||
></script> | ||
<script> | ||
// the mermaid part is from https://github.com/rust-lang/mdBook/issues/762 | ||
|
||
function patchMermaidCodeElementClass() { | ||
var elements = document.getElementsByClassName("language-mermaid"); | ||
Array.from(elements).forEach((pre) => { | ||
Array.from(pre.childNodes).forEach((code) => { | ||
if (code.tagName.toLowerCase() == "code") { | ||
code.className = "mermaid"; | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
document.addEventListener("DOMContentLoaded", function () { | ||
renderMathInElement(document.body, { | ||
delimiters: [ | ||
|
@@ -27,5 +46,8 @@ | |
], | ||
throwOnError: false, | ||
}); | ||
|
||
patchMermaidCodeElementClass(); | ||
mermaid.initialize({ startOnLoad: true }); | ||
}); | ||
</script> |
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