summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Bryan <michaelfbryan@gmail.com>2018-09-16 14:22:50 +0800
committerMichael Bryan <michaelfbryan@gmail.com>2018-09-16 14:22:50 +0800
commit206a00915b350fdb5f0fd9dd6107e743b6338612 (patch)
tree14510635004042fbecb8a9b360f1735e25692467
parentced74ca4dd87ff7e0d9618b757e3536a6a472910 (diff)
Export the mdbook version from the crate root
-rw-r--r--src/lib.rs6
-rw-r--r--src/renderer/mod.rs4
2 files changed, 7 insertions, 3 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 2c91e283..028a2ba8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -114,6 +114,12 @@ 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 book::BookItem;
pub use book::MDBook;
pub use config::Config;
diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs
index 906f7e27..78d208e2 100644
--- a/src/renderer/mod.rs
+++ b/src/renderer/mod.rs
@@ -26,8 +26,6 @@ use book::Book;
use config::Config;
use errors::*;
-const MDBOOK_VERSION: &str = env!("CARGO_PKG_VERSION");
-
/// An arbitrary `mdbook` backend.
///
/// Although it's quite possible for you to import `mdbook` as a library and
@@ -78,7 +76,7 @@ impl RenderContext {
RenderContext {
book: book,
config: config,
- version: MDBOOK_VERSION.to_string(),
+ version: ::MDBOOK_VERSION.to_string(),
root: root.into(),
destination: destination.into(),
}