Add mdbook-core

This is intended as a shared, internal library that will be used by
other mdbook crates. The intention is that those crates will either
directly use, or reexport items from this crate.

Initially this includes MDBOOK_VERSION, which will get reexported from
the preprocessor and renderer crates.
This commit is contained in:
Eric Huss
2025-07-21 10:57:23 -07:00
parent 877a3af671
commit 4a655ff2a3
5 changed files with 36 additions and 8 deletions

7
Cargo.lock generated
View File

@@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
version = 4
[[package]]
name = "addr2line"
@@ -1270,6 +1270,7 @@ dependencies = [
"hex",
"ignore",
"log",
"mdbook-core",
"memchr",
"notify",
"notify-debouncer-mini",
@@ -1293,6 +1294,10 @@ dependencies = [
"walkdir",
]
[[package]]
name = "mdbook-core"
version = "0.5.0-alpha.1"
[[package]]
name = "mdbook-remove-emphasis"
version = "0.1.0"

View File

@@ -1,5 +1,9 @@
[workspace]
members = [".", "examples/remove-emphasis/mdbook-remove-emphasis"]
members = [
".",
"crates/*",
"examples/remove-emphasis/mdbook-remove-emphasis",
]
[workspace.lints.clippy]
all = { level = "allow", priority = -2 }
@@ -16,6 +20,9 @@ license = "MPL-2.0"
repository = "https://github.com/rust-lang/mdBook"
rust-version = "1.85.0" # Keep in sync with installation.md and .github/workflows/main.yml
[workspace.dependencies]
mdbook-core = { path = "crates/mdbook-core" }
[package]
name = "mdbook"
version = "0.4.52"
@@ -43,6 +50,7 @@ env_logger = "0.11.1"
handlebars = "6.0"
hex = "0.4.3"
log = "0.4.17"
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.

View File

@@ -0,0 +1,13 @@
[package]
name = "mdbook-core"
version = "0.5.0-alpha.1"
description = "The base support library for mdbook, intended for internal use only"
edition.workspace = true
license.workspace = true
repository.workspace = true
rust-version.workspace = true
[dependencies]
[lints]
workspace = true

View File

@@ -0,0 +1,7 @@
//! The base support library for mdbook, intended for internal use only.
/// The current version of `mdbook`.
///
/// This is provided as a way for custom preprocessors and renderers to do
/// compatibility checks.
pub const MDBOOK_VERSION: &str = env!("CARGO_PKG_VERSION");

View File

@@ -88,16 +88,11 @@ pub mod renderer;
pub mod theme;
pub mod utils;
/// The current version of `mdbook`.
///
/// This is provided as a way for custom preprocessors and renderers to do
/// compatibility checks.
pub const MDBOOK_VERSION: &str = env!("CARGO_PKG_VERSION");
pub use crate::book::BookItem;
pub use crate::book::MDBook;
pub use crate::config::Config;
pub use crate::renderer::Renderer;
pub use mdbook_core::MDBOOK_VERSION;
/// The error types used through out this crate.
pub mod errors {