Skip to content

Commit

Permalink
chore: re-export TransitionTables and GreedyTokenizer, render mer…
Browse files Browse the repository at this point in the history
…maid with mermaid.js (#30)
  • Loading branch information
ChieloNewctle authored Nov 6, 2023
1 parent c059267 commit 6189ab2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
22 changes: 22 additions & 0 deletions docs-header.html
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand All @@ -27,5 +46,8 @@
],
throwOnError: false,
});

patchMermaidCodeElementClass();
mermaid.initialize({ startOnLoad: true });
});
</script>
7 changes: 5 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ pub use {
GeneralSAM, GeneralSAMNode, GeneralSAMNodeID, GeneralSAMState, SAM_NIL_NODE_ID,
SAM_ROOT_NODE_ID,
},
table::{BTreeTransTable, ConstructiveTransitionTable, TransitionTable},
table::{
BTreeTransTable, BoxBisectTable, ConstructiveTransitionTable, HashTransTable,
SmallAlphabet, TransitionTable, VecBisectTable, WholeAlphabetTable,
},
trie_alike::{IterAsChain, TravelEvent, TrieNodeAlike},
};

Expand All @@ -120,7 +123,7 @@ pub use trie::{Trie, TrieNode, TrieNodeID, TrieState, TRIE_NIL_NODE_ID, TRIE_ROO
pub mod utils;
#[cfg(feature = "utils")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "utils")))]
pub use utils::{rope, suffixwise, tokenize};
pub use utils::{rope, suffixwise, tokenize, tokenize::GreedyTokenizer};

#[cfg(test)]
mod tests;

0 comments on commit 6189ab2

Please sign in to comment.