Skip to content

Commit

Permalink
shorten mod name&group render
Browse files Browse the repository at this point in the history
  • Loading branch information
SichangHe committed Mar 17, 2024
1 parent 3ae83ec commit ba2839b
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 12 deletions.
6 changes: 0 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,5 @@ pub mod scan;
#[cfg(feature = "pre-render")]
pub mod render;

#[cfg(feature = "pre-render")]
pub mod preprocess_render;

#[cfg(feature = "pre-render")]
pub mod cfg_render;

#[cfg(test)]
mod tests;
3 changes: 0 additions & 3 deletions src/preprocess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ pub fn process_all_chapters_prerender(
panic!("Pre-render is unavailable because this `mdbook-katex` program does not have the `pre-render` feature enabled, only escaping mode is available, and you can set `pre-render = false` to enable it. If you do need `pre-render` mode, you need to add the `pre-render` feature and recompile. See the README at <https://github.com/lzanini/mdbook-katex/blob/master/README.md>.")
}

#[cfg(feature = "pre-render")]
use crate::preprocess_render::process_all_chapters_prerender;

/// Header that points to CDN for the KaTeX stylesheet.
pub const KATEX_HEADER: &str = r#"<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css">
Expand Down
5 changes: 5 additions & 0 deletions src/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ use katex::Opts;

use super::*;

pub use {cfg::*, preprocess::*};

mod cfg;
mod preprocess;

/// Render a math block `item` into HTML following `opts`.
/// Wrap result in `<data>` tag if `extra_opts.include_src`.
pub fn render(item: &str, opts: Opts, extra_opts: ExtraOpts) -> String {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn test_support_html() {
assert!(preprocessor.supports_renderer("other_renderer"))
}

mod escape_test;
mod escape;

#[cfg(feature = "pre-render")]
mod render_test;
mod render;
1 change: 0 additions & 1 deletion src/tests/render_test.rs → src/tests/render.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use super::*;
use crate::{cfg_render::*, preprocess_render::*};

fn test_render(raw_content: &str) -> (String, String) {
let (stylesheet_header, mut rendered) = test_render_with_macro(&[raw_content], HashMap::new());
Expand Down
File renamed without changes.

0 comments on commit ba2839b

Please sign in to comment.