Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
25a3fb3
extern_args module to get proper compiler args from Cargo.
bobhy Dec 9, 2024
a166f21
Add config.rust.package-dir and fix cargo output parser (maybe not fo…
bobhy Dec 10, 2024
c926113
Force --extern <name>=<path>.rmeta to .rlib. Cargo sometimes tries t…
bobhy Dec 10, 2024
3eb20b3
Modify user guide so code samples can reference external crates.
bobhy Dec 10, 2024
96c2aee
Update guide to describe configuring book for external crates;
bobhy Dec 10, 2024
7b3a1e2
Fix CI nits.
bobhy Dec 10, 2024
138256f
Replace unstable fs::set_modified() with ad-hoc "touch" function.
bobhy Dec 11, 2024
3306d20
Fuzzy up touch file test in case sleep() is not totally precise.
bobhy Dec 11, 2024
d9d1f35
trigger rebuild if project has main.rs (but broken for other binary t…
bobhy Dec 12, 2024
6104051
Make guide into workspace child so it can share same dependencies wit…
bobhy Dec 14, 2024
cb77a89
When running build, pull dependencies from the build of the doctest c…
bobhy Dec 14, 2024
7fa966f
Compile, but do not run the preprocessor examples.
bobhy Dec 14, 2024
1703aa1
fix broken unit tests
bobhy Dec 14, 2024
9532dbc
book.tom.l must configure path to Cargo.toml, not just root folder of…
bobhy Dec 15, 2024
9cbd047
Doc changes to cover how to use external crates in doctests (and rela…
bobhy Dec 15, 2024
9c5dec2
fix fmt not caught locally
bobhy Dec 15, 2024
658221c
Document deprecating `mdbook test -L`
bobhy Dec 16, 2024
a3fc58b
fix `mdbook test <path/to/root>;
bobhy Dec 17, 2024
d62904b
revert pulldown-cmark from 0.12.2 to 0.10.0 (sigh)
bobhy Dec 17, 2024
b2eb96c
finalize doc updates for new feature
bobhy Dec 17, 2024
248f490
All doctests in mdbook project now pass.
bobhy Dec 17, 2024
38c8f5b
Provide error context if can't find or open Cargo.toml;
bobhy Dec 18, 2024
ab5b3ab
Fix unintended change, per review
bobhy Jan 2, 2025
730e11c
fix clippy nags in files I changed
bobhy Jan 2, 2025
c209369
fix unit test failure
bobhy Jan 2, 2025
19859b0
Try to merge (it's been a while)
bobhy Nov 8, 2025
b9be9bc
Migrate changes for ExternArgs from root to crates mdbook-core and md…
bobhy Nov 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ The following is a summary of the changes that may require your attention when u
[#2926](https://github.com/rust-lang/mdBook/pull/2926)
- Hide the sidebar resize indicator when JS isn't available.
[#2923](https://github.com/rust-lang/mdBook/pull/2923)
- Allow doctests to use external crates by referencing a `Cargo.toml`

## mdBook 0.5.0-beta.1
[v0.5.0-alpha.1...v0.5.0-beta.1](https://github.com/rust-lang/mdBook/compare/v0.5.0-alpha.1...v0.5.0-beta.1)
Expand Down
73 changes: 66 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ rust-version = "1.88.0" # Keep in sync with installation.md and .github/workflow
[workspace.dependencies]
anyhow = "1.0.100"
axum = "0.8.6"
cargo-manifest = "0.19.1"
clap = { version = "4.5.51", features = ["cargo", "wrap_help"] }
clap_complete = "4.5.60"
ego-tree = "0.10.0"
Expand Down Expand Up @@ -75,7 +76,7 @@ version = "0.5.0-beta.2"
authors = [
"Mathieu David <mathieudavid@mathieudavid.org>",
"Michael-F-Bryan <michaelfbryan@gmail.com>",
"Matt Ickstadt <mattico8@gmail.com>"
"Matt Ickstadt <mattico8@gmail.com>",
]
documentation = "https://rust-lang.github.io/mdBook/index.html"
edition.workspace = true
Expand Down
1 change: 1 addition & 0 deletions crates/mdbook-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ rust-version.workspace = true

[dependencies]
anyhow.workspace = true
cargo-manifest.workspace = true
regex.workspace = true
serde.workspace = true
serde_json.workspace = true
Expand Down
26 changes: 25 additions & 1 deletion crates/mdbook-core/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,8 @@ impl Default for BuildConfig {
#[serde(default, rename_all = "kebab-case", deny_unknown_fields)]
#[non_exhaustive]
pub struct RustConfig {
/// Path to a Cargo.toml
pub manifest: Option<PathBuf>,
/// Rust edition used in playground
pub edition: Option<RustEdition>,
}
Expand Down Expand Up @@ -737,6 +739,9 @@ mod tests {
create-missing = false
use-default-preprocessors = true

[rust]
manifest = "./Cargo.toml"

[output.html]
theme = "./themedir"
default-theme = "rust"
Expand Down Expand Up @@ -775,7 +780,10 @@ mod tests {
use_default_preprocessors: true,
extra_watch_dirs: Vec::new(),
};
let rust_should_be = RustConfig { edition: None };
let rust_should_be = RustConfig {
manifest: Some(PathBuf::from("./Cargo.toml")),
edition: None,
};
let playground_should_be = Playground {
editable: true,
copyable: true,
Expand Down Expand Up @@ -853,6 +861,7 @@ mod tests {
assert_eq!(got.book, book_should_be);

let rust_should_be = RustConfig {
manifest: None,
edition: Some(RustEdition::E2015),
};
let got = Config::from_str(src).unwrap();
Expand All @@ -872,6 +881,7 @@ mod tests {
"#;

let rust_should_be = RustConfig {
manifest: None,
edition: Some(RustEdition::E2018),
};

Expand All @@ -892,6 +902,7 @@ mod tests {
"#;

let rust_should_be = RustConfig {
manifest: None,
edition: Some(RustEdition::E2021),
};

Expand Down Expand Up @@ -1179,6 +1190,19 @@ mod tests {
);
}

/* todo -- make this test fail, as it should
#[test]
#[should_panic(expected = "Invalid configuration file")]
// invalid key in config file should really generate an error...
fn invalid_rust_setting() {
let src = r#"
[rust]
foo = "bar"
"#;

Config::from_str(src).unwrap();
}
*/
#[test]
fn contains_key() {
let src = r#"
Expand Down
Loading