Skip to content

Commit 2d09736

Browse files
author
armandocumate
committed
merge conflicts
2 parents 847b4ce + 36e1f01 commit 2d09736

File tree

14 files changed

+102
-36
lines changed

14 files changed

+102
-36
lines changed

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
# Changelog
22

3+
## mdBook 0.4.22
4+
[40c06f5...4844f72](https://github.com/rust-lang/mdBook/compare/40c06f5...4844f72)
5+
6+
### Added
7+
- Added a `--chapter` option to `mdbook test` to specify a specific chapter to test.
8+
[#1741](https://github.com/rust-lang/mdBook/pull/1741)
9+
- Added CSS styling for `<kbd>` tags.
10+
[#1906](https://github.com/rust-lang/mdBook/pull/1906)
11+
- Added pre-compiled binaries for `x86_64-unknown-linux-musl` and `aarch64-unknown-linux-musl` (see [Releases](https://github.com/rust-lang/mdBook/releases)).
12+
[#1862](https://github.com/rust-lang/mdBook/pull/1862)
13+
- Added `build.extra-watch-dirs` which is an array of additional directories to watch for changes when running `mdbook serve`.
14+
[#1884](https://github.com/rust-lang/mdBook/pull/1884)
15+
16+
### Changed
17+
- Removed the `type="text/javascript"` attribute from `<script>` tags.
18+
[#1881](https://github.com/rust-lang/mdBook/pull/1881)
19+
- Switched to building with Rust Edition 2021.
20+
This raises the minimum supported Rust version to 1.56.
21+
[#1887](https://github.com/rust-lang/mdBook/pull/1887)
22+
- When hidden code is hidden, the hidden parts are no longer copied to the clipboard via the copy button.
23+
[#1911](https://github.com/rust-lang/mdBook/pull/1911)
24+
- Various HTML changes and fixes to be more compliant with HTML5.
25+
[#1924](https://github.com/rust-lang/mdBook/pull/1924)
26+
- The theme picker now shows which theme is currently selected.
27+
[#1935](https://github.com/rust-lang/mdBook/pull/1935)
28+
29+
### Fixed
30+
- Avoid blank line at the end of an ACE code block
31+
[#1836](https://github.com/rust-lang/mdBook/pull/1836)
32+
33+
334
## mdBook 0.4.21
435
[92afe9b...8f01d02](https://github.com/rust-lang/mdBook/compare/92afe9b...8f01d02)
536

Cargo.lock

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

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[package]
22
name = "mdbook"
3-
version = "0.4.21"
3+
version = "0.4.22"
44
authors = [
55
"Mathieu David <[email protected]>",
66
"Michael-F-Bryan <[email protected]>",
77
"Matt Ickstadt <[email protected]>"
88
]
9-
documentation = "http://rust-lang.github.io/mdBook/index.html"
9+
documentation = "https://rust-lang.github.io/mdBook/index.html"
1010
edition = "2021"
1111
exclude = ["/guide/*"]
1212
keywords = ["book", "gitbook", "rustbook", "markdown"]

guide/src/continuous-integration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ A simple approach would be to use the popular `curl` CLI tool to download the ex
2121

2222
```sh
2323
mkdir bin
24-
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.21/mdbook-v0.4.21-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
24+
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.22/mdbook-v0.4.22-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
2525
bin/mdbook build
2626
```
2727

guide/src/format/configuration/general.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ This controls the build process of your book.
8787
build-dir = "book" # the directory where the output is placed
8888
create-missing = true # whether or not to create missing pages
8989
use-default-preprocessors = true # use the default preprocessors
90+
extra-watch-dirs = [] # directories to watch for triggering builds
9091
```
9192

9293
- **build-dir:** The directory to put the rendered book in. By default this is
@@ -108,3 +109,6 @@ use-default-preprocessors = true # use the default preprocessors
108109
default preprocessors from running.
109110
- Adding `[preprocessor.links]`, for example, will ensure, regardless of
110111
`use-default-preprocessors` that `links` it will run.
112+
- **extra-watch-dirs**: A list of paths to directories that will be watched in
113+
the `watch` and `serve` commands. Changes to files under these directories will
114+
trigger rebuilds. Useful if your book depends on files outside its `src` directory.

guide/src/guide/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ To make it easier to run, put the path to the binary into your `PATH`.
2020

2121
To build the `mdbook` executable from source, you will first need to install Rust and Cargo.
2222
Follow the instructions on the [Rust installation page].
23-
mdBook currently requires at least Rust version 1.54.
23+
mdBook currently requires at least Rust version 1.56.
2424

2525
Once you have installed Rust, the following command can be used to build and install mdBook:
2626

src/cmd/watch.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,17 @@ where
146146
// Add the book.toml file to the watcher if it exists
147147
let _ = watcher.watch(book.root.join("book.toml"), NonRecursive);
148148

149+
for dir in &book.config.build.extra_watch_dirs {
150+
let path = dir.canonicalize().unwrap();
151+
if let Err(e) = watcher.watch(&path, Recursive) {
152+
error!(
153+
"Error while watching extra directory {:?}:\n {:?}",
154+
path, e
155+
);
156+
std::process::exit(1);
157+
}
158+
}
159+
149160
info!("Listening for changes...");
150161

151162
loop {
@@ -166,7 +177,11 @@ where
166177
})
167178
.collect::<Vec<_>>();
168179

169-
let paths = remove_ignored_files(&book.root, &paths[..]);
180+
// If we are watching files outside the current repository (via extra-watch-dirs), then they are definitionally
181+
// ignored by gitignore. So we handle this case by including such files into the watched paths list.
182+
let any_external_paths = paths.iter().filter(|p| !p.starts_with(&book.root)).cloned();
183+
let mut paths = remove_ignored_files(&book.root, &paths[..]);
184+
paths.extend(any_external_paths);
170185

171186
if !paths.is_empty() {
172187
closure(paths, &book.root);

src/config.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,8 @@ pub struct BuildConfig {
438438
/// Should the default preprocessors always be used when they are
439439
/// compatible with the renderer?
440440
pub use_default_preprocessors: bool,
441+
/// Extra directories to trigger rebuild when watching/serving
442+
pub extra_watch_dirs: Vec<PathBuf>,
441443
}
442444

443445
impl Default for BuildConfig {
@@ -446,6 +448,7 @@ impl Default for BuildConfig {
446448
build_dir: PathBuf::from("book"),
447449
create_missing: true,
448450
use_default_preprocessors: true,
451+
extra_watch_dirs: Vec::new(),
449452
}
450453
}
451454
}
@@ -527,10 +530,9 @@ pub struct HtmlConfig {
527530
/// directly jumping to editing the currently viewed page.
528531
/// Contains {path} that is replaced with chapter source file path
529532
pub edit_url_template: Option<String>,
530-
/// Endpoint of websocket, for livereload usage. Value loaded from .toml file
531-
/// is ignored, because our code overrides this field with the value [`LIVE_RELOAD_ENDPOINT`]
532-
///
533-
/// [`LIVE_RELOAD_ENDPOINT`]: cmd::serve::LIVE_RELOAD_ENDPOINT
533+
/// Endpoint of websocket, for livereload usage. Value loaded from .toml
534+
/// file is ignored, because our code overrides this field with an
535+
/// internal value (`LIVE_RELOAD_ENDPOINT)
534536
///
535537
/// This config item *should not be edited* by the end user.
536538
#[doc(hidden)]
@@ -772,6 +774,7 @@ mod tests {
772774
build_dir: PathBuf::from("outputs"),
773775
create_missing: false,
774776
use_default_preprocessors: true,
777+
extra_watch_dirs: Vec::new(),
775778
};
776779
let rust_should_be = RustConfig { edition: None };
777780
let playground_should_be = Playground {
@@ -982,6 +985,7 @@ mod tests {
982985
build_dir: PathBuf::from("my-book"),
983986
create_missing: true,
984987
use_default_preprocessors: true,
988+
extra_watch_dirs: Vec::new(),
985989
};
986990

987991
let html_should_be = HtmlConfig {

src/renderer/html_handlebars/hbs_renderer.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ impl HtmlHandlebars {
340340
);
341341
handlebars.register_helper("previous", Box::new(helpers::navigation::previous));
342342
handlebars.register_helper("next", Box::new(helpers::navigation::next));
343+
// TODO: remove theme_option in 0.5, it is not needed.
343344
handlebars.register_helper("theme_option", Box::new(helpers::theme::theme_option));
344345
}
345346

@@ -630,6 +631,7 @@ fn make_data(
630631
);
631632
}
632633

634+
// TODO: remove default_theme in 0.5, it is not needed.
633635
let default_theme = match html_config.default_theme {
634636
Some(ref theme) => theme.to_lowercase(),
635637
None => "light".to_string(),

src/theme/book.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ function playground_text(playground, hidden = true) {
168168
.filter(function (node) {return node.classList.contains("editable"); })
169169
.forEach(function (block) { block.classList.remove('language-rust'); });
170170

171-
Array
172171
code_nodes
173172
.filter(function (node) {return !node.classList.contains("editable"); })
174173
.forEach(function (block) { hljs.highlightBlock(block); });
@@ -302,6 +301,13 @@ function playground_text(playground, hidden = true) {
302301
themePopup.querySelector("button#" + get_theme()).focus();
303302
}
304303

304+
function updateThemeSelected() {
305+
themePopup.querySelectorAll('.theme-selected').forEach(function (el) {
306+
el.classList.remove('theme-selected');
307+
});
308+
themePopup.querySelector("button#" + get_theme()).classList.add('theme-selected');
309+
}
310+
305311
function hideThemes() {
306312
themePopup.style.display = 'none';
307313
themeToggleButton.setAttribute('aria-expanded', false);
@@ -357,6 +363,7 @@ function playground_text(playground, hidden = true) {
357363

358364
html.classList.remove(previousTheme);
359365
html.classList.add(theme);
366+
updateThemeSelected();
360367
}
361368

362369
// Set theme

0 commit comments

Comments
 (0)