mdbook_katex/
lib.rs

1#![deny(missing_docs)]
2//! Preprocess math blocks using KaTeX for mdBook.
3use std::{
4    borrow::Cow,
5    collections::HashMap,
6    collections::VecDeque,
7    fs::File,
8    io::{stderr, Read},
9    path::{Path, PathBuf},
10};
11
12use mdbook::{
13    book::{Book, ChapterMutThin},
14    errors::Result,
15    preprocess::{Preprocessor, PreprocessorContext},
16};
17use rayon::iter::*;
18use serde_derive::{Deserialize, Serialize};
19use tracing::*;
20use tracing_subscriber::EnvFilter;
21
22use {
23    cfg::*,
24    escape::*,
25    preprocess::*,
26    render::*,
27    scan::{Event, *},
28};
29
30pub mod cfg;
31pub mod escape;
32pub mod preprocess;
33pub mod scan;
34
35#[cfg(feature = "pre-render")]
36pub mod render;
37
38#[cfg(test)]
39mod tests;
40
41#[doc(hidden)]
42pub fn init_tracing() {
43    _ = tracing_subscriber::fmt()
44        .with_writer(stderr)
45        .with_ansi(true)
46        .with_env_filter(
47            EnvFilter::builder()
48                .with_default_directive(Level::INFO.into())
49                .from_env_lossy(),
50        )
51        .try_init();
52}