Skip to content

Commit 4a655ff

Browse files
committed
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.
1 parent 877a3af commit 4a655ff

File tree

5 files changed

+36
-8
lines changed

5 files changed

+36
-8
lines changed

Cargo.lock

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
[workspace]
2-
members = [".", "examples/remove-emphasis/mdbook-remove-emphasis"]
2+
members = [
3+
".",
4+
"crates/*",
5+
"examples/remove-emphasis/mdbook-remove-emphasis",
6+
]
37

48
[workspace.lints.clippy]
59
all = { level = "allow", priority = -2 }
@@ -16,6 +20,9 @@ license = "MPL-2.0"
1620
repository = "https://github.com/rust-lang/mdBook"
1721
rust-version = "1.85.0" # Keep in sync with installation.md and .github/workflows/main.yml
1822

23+
[workspace.dependencies]
24+
mdbook-core = { path = "crates/mdbook-core" }
25+
1926
[package]
2027
name = "mdbook"
2128
version = "0.4.52"
@@ -43,6 +50,7 @@ env_logger = "0.11.1"
4350
handlebars = "6.0"
4451
hex = "0.4.3"
4552
log = "0.4.17"
53+
mdbook-core.workspace = true
4654
memchr = "2.5.0"
4755
opener = "0.8.1"
4856
pulldown-cmark = { version = "0.10.0", default-features = false, features = ["html"] } # Do not update, part of the public api.

crates/mdbook-core/Cargo.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[package]
2+
name = "mdbook-core"
3+
version = "0.5.0-alpha.1"
4+
description = "The base support library for mdbook, intended for internal use only"
5+
edition.workspace = true
6+
license.workspace = true
7+
repository.workspace = true
8+
rust-version.workspace = true
9+
10+
[dependencies]
11+
12+
[lints]
13+
workspace = true

crates/mdbook-core/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//! The base support library for mdbook, intended for internal use only.
2+
3+
/// The current version of `mdbook`.
4+
///
5+
/// This is provided as a way for custom preprocessors and renderers to do
6+
/// compatibility checks.
7+
pub const MDBOOK_VERSION: &str = env!("CARGO_PKG_VERSION");

src/lib.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,11 @@ pub mod renderer;
8888
pub mod theme;
8989
pub mod utils;
9090

91-
/// The current version of `mdbook`.
92-
///
93-
/// This is provided as a way for custom preprocessors and renderers to do
94-
/// compatibility checks.
95-
pub const MDBOOK_VERSION: &str = env!("CARGO_PKG_VERSION");
96-
9791
pub use crate::book::BookItem;
9892
pub use crate::book::MDBook;
9993
pub use crate::config::Config;
10094
pub use crate::renderer::Renderer;
95+
pub use mdbook_core::MDBOOK_VERSION;
10196

10297
/// The error types used through out this crate.
10398
pub mod errors {

0 commit comments

Comments
 (0)