mirror of
https://github.com/rust-lang/mdBook.git
synced 2025-12-27 15:03:52 -05:00
Compare commits
10 Commits
v0.5.0-bet
...
ehuss-patc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
405f407260 | ||
|
|
eaa778bebd | ||
|
|
a17c1d1b95 | ||
|
|
8a27d1b7ac | ||
|
|
d6cd50b601 | ||
|
|
68d9bcfec4 | ||
|
|
3fa49214ad | ||
|
|
ddf02e0c0c | ||
|
|
3992bc18f5 | ||
|
|
49f9c9741e |
@@ -76,7 +76,7 @@ The following is a summary of the changes that may require your attention when u
|
||||
- [`mdbook-markdown`](https://docs.rs/mdbook-markdown/latest/mdbook_markdown/) — The Markdown renderer. If you are processing markdown, this is the crate you should depend on. This is essentially a thin wrapper around `pulldown-cmark`, and re-exports that crate so that you can ensure the version stays in sync with mdBook.
|
||||
- [`mdbook-summary`](https://docs.rs/mdbook-summary/latest/mdbook_summary/) — The `SUMMARY.md` parser.
|
||||
- [`mdbook-html`](https://docs.rs/mdbook-html/latest/mdbook_html/) — The HTML renderer.
|
||||
- [`mdbook-core`](https://docs.rs/mdbook-core/latest/mdbook_core/) — An internal library that is used by the other crates for shared types. You should not depend on this crate directly since types from this crate are rexported from the other crates as appropriate.
|
||||
- [`mdbook-core`](https://docs.rs/mdbook-core/latest/mdbook_core/) — An internal library that is used by the other crates for shared types. You should not depend on this crate directly since types from this crate are re-exported from the other crates as appropriate.
|
||||
- Changes to `Config`:
|
||||
- [`Config::get`](https://docs.rs/mdbook-core/latest/mdbook_core/config/struct.Config.html#method.get) is now generic over the return value, using `serde` to deserialize the value. It also returns a `Result` to handle deserialization errors. [#2773](https://github.com/rust-lang/mdBook/pull/2773)
|
||||
- Removed `Config::get_deserialized`. Use `Config::get` instead.
|
||||
|
||||
@@ -104,7 +104,7 @@ fn tidy(path: &Path) {
|
||||
|
||||
fn diff(a: &Path, b: &Path) {
|
||||
let args = "diff --no-index";
|
||||
println!("running `git diff {args} {a:?} {b:?}`");
|
||||
println!("running `git {args} {a:?} {b:?}`");
|
||||
Command::new("git")
|
||||
.args(args.split(' '))
|
||||
.args([a, b])
|
||||
|
||||
@@ -27,3 +27,6 @@ tracing.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[features]
|
||||
search = ["mdbook-html/search"]
|
||||
|
||||
@@ -23,6 +23,12 @@
|
||||
//! for shared types. Types from this crate are rexported from the other
|
||||
//! crates as appropriate.
|
||||
//!
|
||||
//! ## Cargo features
|
||||
//!
|
||||
//! The following cargo features are available:
|
||||
//!
|
||||
//! - `search`: Enables the search index in the HTML renderer.
|
||||
//!
|
||||
//! ## Examples
|
||||
//!
|
||||
//! If creating a new book from scratch, you'll want to get a [`init::BookBuilder`] via
|
||||
|
||||
@@ -13,7 +13,6 @@ Original by Dempfi (https://github.com/dempfi/ayu)
|
||||
.hljs-comment,
|
||||
.hljs-quote {
|
||||
color: #5c6773;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.hljs-variable,
|
||||
|
||||
@@ -141,7 +141,14 @@ fn partition_rust_source(s: &str) -> (&str, &str) {
|
||||
let split_idx = match HEADER_RE.captures(s) {
|
||||
Some(caps) => {
|
||||
let attributes = &caps[1];
|
||||
attributes.len()
|
||||
if attributes.trim().is_empty() {
|
||||
// Don't include pure whitespace as an attribute. The
|
||||
// whitespace in the regex is intended to handle multiple
|
||||
// attributes *separated* by potential whitespace.
|
||||
0
|
||||
} else {
|
||||
attributes.len()
|
||||
}
|
||||
}
|
||||
None => 0,
|
||||
};
|
||||
@@ -179,4 +186,8 @@ fn it_partitions_rust_source() {
|
||||
),
|
||||
("\n#![allow(foo)]\n\n#![allow(bar)]\n\n", "let x = 1;")
|
||||
);
|
||||
assert_eq!(
|
||||
partition_rust_source(" // Example"),
|
||||
("", " // Example")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -223,3 +223,9 @@ Html text was:
|
||||
fn html_blocks() {
|
||||
BookTest::from_dir("rendering/html_blocks").check_all_main_files();
|
||||
}
|
||||
|
||||
// Test for a fenced code block that is also indented.
|
||||
#[test]
|
||||
fn code_block_fenced_with_indent() {
|
||||
BookTest::from_dir("rendering/code_blocks_fenced_with_indent").check_all_main_files();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
[book]
|
||||
title = "code_blocks_fenced_with_indent"
|
||||
@@ -0,0 +1,6 @@
|
||||
<h1 id="code-blocks-fenced-with-indent"><a class="header" href="#code-blocks-fenced-with-indent">Code blocks fenced with indent</a></h1>
|
||||
<pre class="playground"><code class="language-rust"><span class="boring">#![allow(unused)]
|
||||
</span><span class="boring">fn main() {
|
||||
</span> // This has a first line that is indented.
|
||||
println!("hello");
|
||||
<span class="boring">}</span></code></pre>
|
||||
@@ -0,0 +1,3 @@
|
||||
# Summary
|
||||
|
||||
- [Code blocks fenced with indent](./code-blocks-fenced-with-indent.md)
|
||||
@@ -0,0 +1,6 @@
|
||||
# Code blocks fenced with indent
|
||||
|
||||
```rust
|
||||
// This has a first line that is indented.
|
||||
println!("hello");
|
||||
```
|
||||
Reference in New Issue
Block a user