Export the mdbook version from the crate root

This commit is contained in:
Michael Bryan 2018-09-16 14:22:50 +08:00
parent ced74ca4dd
commit 206a00915b
No known key found for this signature in database
GPG Key ID: E9C602B0D9A998DC
2 changed files with 7 additions and 3 deletions

View File

@ -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;

View File

@ -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(),
}