diff --git a/Cargo.lock b/Cargo.lock index 732e62a9..b7555940 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1299,6 +1299,11 @@ name = "mdbook-core" version = "0.5.0-alpha.1" dependencies = [ "anyhow", + "log", + "pulldown-cmark 0.10.3", + "regex", + "tempfile", + "toml", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index ee570234..a8c4331c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,12 @@ rust-version = "1.85.0" # Keep in sync with installation.md and .github/workflow [workspace.dependencies] anyhow = "1.0.98" +log = "0.4.27" mdbook-core = { path = "crates/mdbook-core" } +pulldown-cmark = { version = "0.10.3", default-features = false, features = ["html"] } # Do not update, part of the public api. +regex = "1.11.1" +tempfile = "3.20.0" +toml = "0.5.11" # Do not update, see https://github.com/rust-lang/mdBook/issues/2037 [package] name = "mdbook" @@ -50,18 +55,18 @@ clap_complete = "4.3.2" env_logger = "0.11.1" handlebars = "6.0" hex = "0.4.3" -log = "0.4.17" +log.workspace = true mdbook-core.workspace = true memchr = "2.5.0" opener = "0.8.1" -pulldown-cmark = { version = "0.10.0", default-features = false, features = ["html"] } # Do not update, part of the public api. -regex = "1.8.1" +pulldown-cmark.workspace = true +regex.workspace = true serde = { version = "1.0.163", features = ["derive"] } serde_json = "1.0.96" sha2 = "0.10.8" shlex = "1.3.0" -tempfile = "3.4.0" -toml = "0.5.11" # Do not update, see https://github.com/rust-lang/mdBook/issues/2037 +tempfile.workspace = true +toml.workspace = true topological-sort = "0.2.2" # Watch feature diff --git a/crates/mdbook-core/Cargo.toml b/crates/mdbook-core/Cargo.toml index 301bfe87..a92a899a 100644 --- a/crates/mdbook-core/Cargo.toml +++ b/crates/mdbook-core/Cargo.toml @@ -9,6 +9,13 @@ rust-version.workspace = true [dependencies] anyhow.workspace = true +log.workspace = true +pulldown-cmark.workspace = true +regex.workspace = true +toml.workspace = true + +[dev-dependencies] +tempfile.workspace = true [lints] workspace = true diff --git a/crates/mdbook-core/src/lib.rs b/crates/mdbook-core/src/lib.rs index d7298926..347d6668 100644 --- a/crates/mdbook-core/src/lib.rs +++ b/crates/mdbook-core/src/lib.rs @@ -10,3 +10,4 @@ pub const MDBOOK_VERSION: &str = env!("CARGO_PKG_VERSION"); pub mod errors { pub use anyhow::{Error, Result}; } +pub mod utils; diff --git a/crates/mdbook-core/src/utils/fs.rs b/crates/mdbook-core/src/utils/fs.rs index 3d126b7a..c8500a73 100644 --- a/crates/mdbook-core/src/utils/fs.rs +++ b/crates/mdbook-core/src/utils/fs.rs @@ -29,7 +29,7 @@ pub fn write_file>(build_dir: &Path, filename: P, content: &[u8]) /// /// ```rust /// # use std::path::Path; -/// # use mdbook::utils::fs::path_to_root; +/// # use mdbook_core::utils::fs::path_to_root; /// let path = Path::new("some/relative/path"); /// assert_eq!(path_to_root(path), "../../"); /// ``` diff --git a/crates/mdbook-core/src/utils/mod.rs b/crates/mdbook-core/src/utils/mod.rs index 50feb025..56bfbb97 100644 --- a/crates/mdbook-core/src/utils/mod.rs +++ b/crates/mdbook-core/src/utils/mod.rs @@ -12,7 +12,7 @@ use std::sync::LazyLock; pub mod fs; mod string; -pub(crate) mod toml_ext; +pub mod toml_ext; pub use self::string::{ take_anchored_lines, take_lines, take_rustdoc_include_anchored_lines, @@ -424,7 +424,8 @@ pub fn log_backtrace(e: &Error) { } } -pub(crate) fn special_escape(mut s: &str) -> String { +/// Escape characters to make it safe for an HTML string. +pub fn special_escape(mut s: &str) -> String { let mut escaped = String::with_capacity(s.len()); let needs_escape: &[char] = &['<', '>', '\'', '"', '\\', '&']; while let Some(next) = s.find(needs_escape) { @@ -444,7 +445,8 @@ pub(crate) fn special_escape(mut s: &str) -> String { escaped } -pub(crate) fn bracket_escape(mut s: &str) -> String { +/// Escape `<` and `>` for HTML. +pub fn bracket_escape(mut s: &str) -> String { let mut escaped = String::with_capacity(s.len()); let needs_escape: &[char] = &['<', '>']; while let Some(next) = s.find(needs_escape) { diff --git a/crates/mdbook-core/src/utils/toml_ext.rs b/crates/mdbook-core/src/utils/toml_ext.rs index bf25ad11..7975ed57 100644 --- a/crates/mdbook-core/src/utils/toml_ext.rs +++ b/crates/mdbook-core/src/utils/toml_ext.rs @@ -1,9 +1,16 @@ +//! Helper for working with toml types. + use toml::value::{Table, Value}; -pub(crate) trait TomlExt { +/// Helper for working with toml types. +pub trait TomlExt { + /// Read a dotted key. fn read(&self, key: &str) -> Option<&Value>; + /// Read a dotted key for a mutable value. fn read_mut(&mut self, key: &str) -> Option<&mut Value>; + /// Insert with a dotted key. fn insert(&mut self, key: &str, value: Value); + /// Delete a dotted key value. fn delete(&mut self, key: &str) -> Option; } diff --git a/src/book/book.rs b/src/book/book.rs index 769c503d..4e902664 100644 --- a/src/book/book.rs +++ b/src/book/book.rs @@ -6,9 +6,9 @@ use std::path::{Path, PathBuf}; use super::summary::{Link, SectionNumber, Summary, SummaryItem, parse_summary}; use crate::config::BuildConfig; -use crate::utils::bracket_escape; use anyhow::{Context, Result}; use log::debug; +use mdbook_core::utils::bracket_escape; use serde::{Deserialize, Serialize}; /// Load a book into memory from its `src/` directory. diff --git a/src/book/init.rs b/src/book/init.rs index b7372e33..07e8a43b 100644 --- a/src/book/init.rs +++ b/src/book/init.rs @@ -5,9 +5,9 @@ use std::path::PathBuf; use super::MDBook; use crate::config::Config; use crate::theme; -use crate::utils::fs::write_file; use anyhow::{Context, Result}; use log::{debug, error, info, trace}; +use mdbook_core::utils::fs::write_file; /// A helper for setting up a new book and its directory structure. #[derive(Debug, Clone, PartialEq)] diff --git a/src/book/mod.rs b/src/book/mod.rs index 117d6ed6..6d9cc670 100644 --- a/src/book/mod.rs +++ b/src/book/mod.rs @@ -27,7 +27,7 @@ use crate::preprocess::{ CmdPreprocessor, IndexPreprocessor, LinkPreprocessor, Preprocessor, PreprocessorContext, }; use crate::renderer::{CmdRenderer, HtmlHandlebars, MarkdownRenderer, RenderContext, Renderer}; -use crate::utils; +use mdbook_core::utils; use crate::config::{Config, RustEdition}; diff --git a/src/cmd/serve.rs b/src/cmd/serve.rs index 85866260..1d3ab6b9 100644 --- a/src/cmd/serve.rs +++ b/src/cmd/serve.rs @@ -10,7 +10,7 @@ use clap::builder::NonEmptyStringValueParser; use futures_util::StreamExt; use futures_util::sink::SinkExt; use mdbook::MDBook; -use mdbook::utils::fs::get_404_output_file; +use mdbook_core::utils::fs::get_404_output_file; use std::net::{SocketAddr, ToSocketAddrs}; use std::path::PathBuf; use tokio::sync::broadcast; diff --git a/src/config.rs b/src/config.rs index 394154ae..4f91ceae 100644 --- a/src/config.rs +++ b/src/config.rs @@ -50,6 +50,8 @@ use crate::utils::{self, toml_ext::TomlExt}; use anyhow::{Context, Error, Result, bail}; use log::{debug, trace, warn}; +use mdbook_core::utils::log_backtrace; +use mdbook_core::utils::toml_ext::TomlExt; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use std::collections::HashMap; use std::env; @@ -182,7 +184,7 @@ impl Config { Ok(Some(config)) => Some(config), Ok(None) => None, Err(e) => { - utils::log_backtrace(&e); + log_backtrace(&e); None } } @@ -812,7 +814,7 @@ impl<'de, T> Updateable<'de> for T where T: Serialize + Deserialize<'de> {} #[cfg(test)] mod tests { use super::*; - use crate::utils::fs::get_404_output_file; + use mdbook_core::utils::fs::get_404_output_file; use serde_json::json; const COMPLEX_CONFIG: &str = r#" diff --git a/src/lib.rs b/src/lib.rs index 7abd2e15..d0b1af8b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -86,7 +86,6 @@ pub mod preprocess; pub mod renderer; #[path = "front-end/mod.rs"] pub mod theme; -pub mod utils; pub use crate::book::BookItem; pub use crate::book::MDBook; diff --git a/src/main.rs b/src/main.rs index 975b5a21..e4e8d55f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,7 +11,7 @@ use clap::{Arg, ArgMatches, Command}; use clap_complete::Shell; use env_logger::Builder; use log::LevelFilter; -use mdbook::utils; +use mdbook_core::utils; use std::env; use std::ffi::OsStr; use std::io::Write; diff --git a/src/preprocess/links.rs b/src/preprocess/links.rs index d431ea20..02d7c4d7 100644 --- a/src/preprocess/links.rs +++ b/src/preprocess/links.rs @@ -1,8 +1,8 @@ -use crate::utils::{ +use anyhow::{Context, Result}; +use mdbook_core::utils::{ take_anchored_lines, take_lines, take_rustdoc_include_anchored_lines, take_rustdoc_include_lines, }; -use anyhow::{Context, Result}; use regex::{CaptureMatches, Captures, Regex}; use std::fs; use std::ops::{Bound, Range, RangeBounds, RangeFrom, RangeFull, RangeTo}; diff --git a/src/renderer/html_handlebars/hbs_renderer.rs b/src/renderer/html_handlebars/hbs_renderer.rs index 4bef3cb3..dd90de55 100644 --- a/src/renderer/html_handlebars/hbs_renderer.rs +++ b/src/renderer/html_handlebars/hbs_renderer.rs @@ -4,8 +4,8 @@ use crate::renderer::html_handlebars::StaticFiles; use crate::renderer::html_handlebars::helpers; use crate::renderer::{RenderContext, Renderer}; use crate::theme::{self, Theme}; -use crate::utils; -use crate::utils::fs::get_404_output_file; +use mdbook_core::utils; +use mdbook_core::utils::fs::get_404_output_file; use std::borrow::Cow; use std::collections::BTreeMap; diff --git a/src/renderer/html_handlebars/helpers/navigation.rs b/src/renderer/html_handlebars/helpers/navigation.rs index 12c69027..1fd43dcf 100644 --- a/src/renderer/html_handlebars/helpers/navigation.rs +++ b/src/renderer/html_handlebars/helpers/navigation.rs @@ -5,8 +5,8 @@ use handlebars::{ Context, Handlebars, Helper, Output, RenderContext, RenderError, RenderErrorReason, Renderable, }; -use crate::utils; use log::{debug, trace}; +use mdbook_core::utils; use serde_json::json; type StringMap = BTreeMap; diff --git a/src/renderer/html_handlebars/helpers/resources.rs b/src/renderer/html_handlebars/helpers/resources.rs index e8818f05..88adafed 100644 --- a/src/renderer/html_handlebars/helpers/resources.rs +++ b/src/renderer/html_handlebars/helpers/resources.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; -use crate::utils; +use mdbook_core::utils; use handlebars::{ Context, Handlebars, Helper, HelperDef, Output, RenderContext, RenderError, RenderErrorReason, diff --git a/src/renderer/html_handlebars/helpers/toc.rs b/src/renderer/html_handlebars/helpers/toc.rs index a3419ce8..9528a355 100644 --- a/src/renderer/html_handlebars/helpers/toc.rs +++ b/src/renderer/html_handlebars/helpers/toc.rs @@ -1,7 +1,7 @@ use std::path::Path; use std::{cmp::Ordering, collections::BTreeMap}; -use crate::utils::special_escape; +use mdbook_core::utils::special_escape; use handlebars::{ Context, Handlebars, Helper, HelperDef, Output, RenderContext, RenderError, RenderErrorReason, diff --git a/src/renderer/html_handlebars/search.rs b/src/renderer/html_handlebars/search.rs index 3299257d..ba9cd274 100644 --- a/src/renderer/html_handlebars/search.rs +++ b/src/renderer/html_handlebars/search.rs @@ -6,6 +6,7 @@ use std::sync::LazyLock; use anyhow::{Context, Result, bail}; use elasticlunr::{Index, IndexBuilder}; use log::{debug, warn}; +use mdbook_core::utils; use pulldown_cmark::*; use serde::Serialize; @@ -13,7 +14,6 @@ use crate::book::{Book, BookItem, Chapter}; use crate::config::{Search, SearchChapterSettings}; use crate::renderer::html_handlebars::StaticFiles; use crate::theme::searcher; -use crate::utils; const MAX_WORD_LENGTH_TO_INDEX: usize = 80; diff --git a/src/renderer/html_handlebars/static_files.rs b/src/renderer/html_handlebars/static_files.rs index 1b6aa9f7..ffd07687 100644 --- a/src/renderer/html_handlebars/static_files.rs +++ b/src/renderer/html_handlebars/static_files.rs @@ -2,11 +2,11 @@ use anyhow::{Context, Result}; use log::{debug, warn}; +use mdbook_core::utils; use crate::config::HtmlConfig; use crate::renderer::html_handlebars::helpers::resources::ResourceHelper; use crate::theme::{self, Theme, playground_editor}; -use crate::utils; use std::borrow::Cow; use std::collections::HashMap; @@ -227,7 +227,7 @@ impl StaticFiles { } pub fn write_files(self, destination: &Path) -> Result { - use crate::utils::fs::write_file; + use mdbook_core::utils::fs::write_file; use regex::bytes::{Captures, Regex}; // The `{{ resource "name" }}` directive in static resources look like // handlebars syntax, even if they technically aren't. @@ -302,7 +302,7 @@ mod tests { use super::*; use crate::config::HtmlConfig; use crate::theme::Theme; - use crate::utils::fs::write_file; + use mdbook_core::utils::fs::write_file; use tempfile::TempDir; #[test] diff --git a/src/renderer/markdown_renderer.rs b/src/renderer/markdown_renderer.rs index ac80aaa2..638b21f0 100644 --- a/src/renderer/markdown_renderer.rs +++ b/src/renderer/markdown_renderer.rs @@ -1,8 +1,8 @@ use crate::book::BookItem; use crate::renderer::{RenderContext, Renderer}; -use crate::utils; use anyhow::{Context, Result}; use log::trace; +use mdbook_core::utils; use std::fs; #[derive(Default)] diff --git a/tests/testsuite/book_test.rs b/tests/testsuite/book_test.rs index ed5ebe83..57b5f3f3 100644 --- a/tests/testsuite/book_test.rs +++ b/tests/testsuite/book_test.rs @@ -35,7 +35,7 @@ impl BookTest { let dir = Path::new("tests/testsuite").join(dir); assert!(dir.exists(), "{dir:?} should exist"); let tmp = Self::new_tmp(); - mdbook::utils::fs::copy_files_except_ext( + mdbook_core::utils::fs::copy_files_except_ext( &dir, &tmp, true, diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs index 1737bdf9..98972c4b 100644 --- a/tests/testsuite/build.rs +++ b/tests/testsuite/build.rs @@ -24,8 +24,8 @@ fn basic_build() { fn failure_on_missing_file() { BookTest::from_dir("build/missing_file").run("build", |cmd| { cmd.expect_failure().expect_stderr(str![[r#" -[TIMESTAMP] [ERROR] (mdbook::utils): Error: Chapter file not found, ./chapter_1.md -[TIMESTAMP] [ERROR] (mdbook::utils): [TAB]Caused By: [NOT_FOUND] +[TIMESTAMP] [ERROR] (mdbook_core::utils): Error: Chapter file not found, ./chapter_1.md +[TIMESTAMP] [ERROR] (mdbook_core::utils): [TAB]Caused By: [NOT_FOUND] "#]]); }); @@ -48,8 +48,8 @@ fn no_reserved_filename() { cmd.expect_failure().expect_stderr(str![[r#" [TIMESTAMP] [INFO] (mdbook::book): Book building has started [TIMESTAMP] [INFO] (mdbook::book): Running the html backend -[TIMESTAMP] [ERROR] (mdbook::utils): Error: Rendering failed -[TIMESTAMP] [ERROR] (mdbook::utils): [TAB]Caused By: print.md is reserved for internal use +[TIMESTAMP] [ERROR] (mdbook_core::utils): Error: Rendering failed +[TIMESTAMP] [ERROR] (mdbook_core::utils): [TAB]Caused By: print.md is reserved for internal use "#]]); }); diff --git a/tests/testsuite/markdown.rs b/tests/testsuite/markdown.rs index 72643369..3fc08425 100644 --- a/tests/testsuite/markdown.rs +++ b/tests/testsuite/markdown.rs @@ -22,10 +22,10 @@ fn footnotes() { cmd.expect_stderr(str![[r#" [TIMESTAMP] [INFO] (mdbook::book): Book building has started [TIMESTAMP] [INFO] (mdbook::book): Running the html backend -[TIMESTAMP] [WARN] (mdbook::utils): footnote `multiple-definitions` in defined multiple times - not updating to new definition -[TIMESTAMP] [WARN] (mdbook::utils): footnote `unused` in `` is defined but not referenced -[TIMESTAMP] [WARN] (mdbook::utils): footnote `multiple-definitions` in footnotes.md defined multiple times - not updating to new definition -[TIMESTAMP] [WARN] (mdbook::utils): footnote `unused` in `footnotes.md` is defined but not referenced +[TIMESTAMP] [WARN] (mdbook_core::utils): footnote `multiple-definitions` in defined multiple times - not updating to new definition +[TIMESTAMP] [WARN] (mdbook_core::utils): footnote `unused` in `` is defined but not referenced +[TIMESTAMP] [WARN] (mdbook_core::utils): footnote `multiple-definitions` in footnotes.md defined multiple times - not updating to new definition +[TIMESTAMP] [WARN] (mdbook_core::utils): footnote `unused` in `footnotes.md` is defined but not referenced [TIMESTAMP] [INFO] (mdbook::renderer::html_handlebars::hbs_renderer): HTML book written to `[ROOT]/book` "#]]); diff --git a/tests/testsuite/preprocessor.rs b/tests/testsuite/preprocessor.rs index b2188db1..51f4a2a2 100644 --- a/tests/testsuite/preprocessor.rs +++ b/tests/testsuite/preprocessor.rs @@ -64,7 +64,7 @@ fn failing_preprocessor() { .expect_stderr(str![[r#" [TIMESTAMP] [INFO] (mdbook::book): Book building has started Boom!!1! -[TIMESTAMP] [ERROR] (mdbook::utils): Error: The "nop-preprocessor" preprocessor exited unsuccessfully with [EXIT_STATUS]: 1 status +[TIMESTAMP] [ERROR] (mdbook_core::utils): Error: The "nop-preprocessor" preprocessor exited unsuccessfully with [EXIT_STATUS]: 1 status "#]]); }); diff --git a/tests/testsuite/redirects.rs b/tests/testsuite/redirects.rs index d92bf766..93fd9113 100644 --- a/tests/testsuite/redirects.rs +++ b/tests/testsuite/redirects.rs @@ -24,9 +24,9 @@ fn redirect_removed_with_fragments_only() { cmd.expect_failure().expect_stderr(str![[r#" [TIMESTAMP] [INFO] (mdbook::book): Book building has started [TIMESTAMP] [INFO] (mdbook::book): Running the html backend -[TIMESTAMP] [ERROR] (mdbook::utils): Error: Rendering failed -[TIMESTAMP] [ERROR] (mdbook::utils): [TAB]Caused By: Unable to emit redirects -[TIMESTAMP] [ERROR] (mdbook::utils): [TAB]Caused By: redirect entry for `old-file.html` only has source paths with `#` fragments +[TIMESTAMP] [ERROR] (mdbook_core::utils): Error: Rendering failed +[TIMESTAMP] [ERROR] (mdbook_core::utils): [TAB]Caused By: Unable to emit redirects +[TIMESTAMP] [ERROR] (mdbook_core::utils): [TAB]Caused By: redirect entry for `old-file.html` only has source paths with `#` fragments There must be an entry without the `#` fragment to determine the default destination. "#]]); @@ -40,8 +40,8 @@ fn redirect_existing_page() { cmd.expect_failure().expect_stderr(str![[r#" [TIMESTAMP] [INFO] (mdbook::book): Book building has started [TIMESTAMP] [INFO] (mdbook::book): Running the html backend -[TIMESTAMP] [ERROR] (mdbook::utils): Error: Rendering failed -[TIMESTAMP] [ERROR] (mdbook::utils): [TAB]Caused By: redirect found for existing chapter at `/chapter_1.html` +[TIMESTAMP] [ERROR] (mdbook_core::utils): Error: Rendering failed +[TIMESTAMP] [ERROR] (mdbook_core::utils): [TAB]Caused By: redirect found for existing chapter at `/chapter_1.html` Either delete the redirect or remove the chapter. "#]]); diff --git a/tests/testsuite/renderer.rs b/tests/testsuite/renderer.rs index 45739d09..923bd5dd 100644 --- a/tests/testsuite/renderer.rs +++ b/tests/testsuite/renderer.rs @@ -68,8 +68,8 @@ fn failing_command() { [TIMESTAMP] [INFO] (mdbook::book): Running the failing backend [TIMESTAMP] [INFO] (mdbook::renderer): Invoking the "failing" renderer [TIMESTAMP] [ERROR] (mdbook::renderer): Renderer exited with non-zero return code. -[TIMESTAMP] [ERROR] (mdbook::utils): Error: Rendering failed -[TIMESTAMP] [ERROR] (mdbook::utils): [TAB]Caused By: The "failing" renderer failed +[TIMESTAMP] [ERROR] (mdbook_core::utils): Error: Rendering failed +[TIMESTAMP] [ERROR] (mdbook_core::utils): [TAB]Caused By: The "failing" renderer failed "#]]); }); @@ -86,9 +86,9 @@ fn missing_renderer() { [TIMESTAMP] [INFO] (mdbook::book): Running the missing backend [TIMESTAMP] [INFO] (mdbook::renderer): Invoking the "missing" renderer [TIMESTAMP] [ERROR] (mdbook::renderer): The command `trduyvbhijnorgevfuhn` wasn't found, is the "missing" backend installed? If you want to ignore this error when the "missing" backend is not installed, set `optional = true` in the `[output.missing]` section of the book.toml configuration file. -[TIMESTAMP] [ERROR] (mdbook::utils): Error: Rendering failed -[TIMESTAMP] [ERROR] (mdbook::utils): [TAB]Caused By: Unable to start the backend -[TIMESTAMP] [ERROR] (mdbook::utils): [TAB]Caused By: [NOT_FOUND] +[TIMESTAMP] [ERROR] (mdbook_core::utils): Error: Rendering failed +[TIMESTAMP] [ERROR] (mdbook_core::utils): [TAB]Caused By: Unable to start the backend +[TIMESTAMP] [ERROR] (mdbook_core::utils): [TAB]Caused By: [NOT_FOUND] "#]]); }); diff --git a/tests/testsuite/search.rs b/tests/testsuite/search.rs index 5eca0e43..a8f05120 100644 --- a/tests/testsuite/search.rs +++ b/tests/testsuite/search.rs @@ -137,8 +137,8 @@ fn chapter_settings_validation_error() { cmd.expect_failure().expect_stderr(str![[r#" [TIMESTAMP] [INFO] (mdbook::book): Book building has started [TIMESTAMP] [INFO] (mdbook::book): Running the html backend -[TIMESTAMP] [ERROR] (mdbook::utils): Error: Rendering failed -[TIMESTAMP] [ERROR] (mdbook::utils): [TAB]Caused By: [output.html.search.chapter] key `does-not-exist` does not match any chapter paths +[TIMESTAMP] [ERROR] (mdbook_core::utils): Error: Rendering failed +[TIMESTAMP] [ERROR] (mdbook_core::utils): [TAB]Caused By: [output.html.search.chapter] key `does-not-exist` does not match any chapter paths "#]]); }); diff --git a/tests/testsuite/test.rs b/tests/testsuite/test.rs index 54be8695..5fd2cc7e 100644 --- a/tests/testsuite/test.rs +++ b/tests/testsuite/test.rs @@ -48,7 +48,7 @@ test failing_include.md - Failing_Include (line 3) ... FAILED thread 'main' panicked at failing_include.md:3:1: failing! ... -[TIMESTAMP] [ERROR] (mdbook::utils): Error: One or more tests failed +[TIMESTAMP] [ERROR] (mdbook_core::utils): Error: One or more tests failed "#]]); }); @@ -82,7 +82,7 @@ fn chapter_not_found() { cmd.expect_failure() .expect_stdout(str![[""]]) .expect_stderr(str![[r#" -[TIMESTAMP] [ERROR] (mdbook::utils): Error: Chapter not found: bogus +[TIMESTAMP] [ERROR] (mdbook_core::utils): Error: Chapter not found: bogus "#]]); }); diff --git a/tests/testsuite/theme.rs b/tests/testsuite/theme.rs index b22ae4e2..8ebb0c64 100644 --- a/tests/testsuite/theme.rs +++ b/tests/testsuite/theme.rs @@ -11,8 +11,8 @@ cmd.expect_failure() .expect_stderr(str![[r#" [TIMESTAMP] [INFO] (mdbook::book): Book building has started [TIMESTAMP] [INFO] (mdbook::book): Running the html backend -[TIMESTAMP] [ERROR] (mdbook::utils): Error: Rendering failed -[TIMESTAMP] [ERROR] (mdbook::utils): [TAB]Caused By: theme dir [ROOT]/./non-existent-directory does not exist +[TIMESTAMP] [ERROR] (mdbook_core::utils): Error: Rendering failed +[TIMESTAMP] [ERROR] (mdbook_core::utils): [TAB]Caused By: theme dir [ROOT]/./non-existent-directory does not exist "#]]); });