This guarantees we use the exact same config mdBook does, preventing a
class of bugs where we renderer something different than the baseline
output would simply because we are preprocessing.
- Use `let` instead of `var` throughout. All modern browsers support it
and have for many years, even the now-EOL IE11.[^ie]
- Add a `@ts-check` annotation so that anyone working on a TS-enabled
editor will get feedback inline about cases they may otherwise miss.
- Add JSDoc-based type definitions for the script, and fix some errors
that may occur at runtime. (These will be rare if they happen, but
getting rid of them is still a win!)
[^ie]: IE11 did not correctly support the semantics of `let` for `for`
loops, but the uses in the existing code here already used `var` in
a way which would trigger the same behavior as using `let` does.
This prevents us from pulling in `notify` accidentally, which is causing
a `tidy check` issue in `rust-lang/rust` because of the CC0 license on
`notify`. I had intended to address this in efd315a3, but forgot that
`features = []` does not imply `default-features = false`.
Remove these from the workspace, because they will need to be used as
path dependencies in `rust-lang/rust`, as part of the build, because the
Rust build pipeline invokes mdBook programmatically rather than via
tools built directly, and we really don’t want to muck with publishing
these to crates.io at present. As a result, they cannot be part of this
workspace, because path dependencies do not get built as a crate within
the hosting workspace. Make sure they do not rely on any features other
than the core `mdbook` library.
Previously, this was only pushing in the opening paragraph tag before
getting to text, so it was accidentally dropping cases where the text
started after some other opening tag, e.g. strong emphasis.
- Add CSS for `figure.listing`; this now renders identically to how the
existing listings render.
- Convert the first listing in the book to use `<Listing>` instead of
a bunch of `<span>`s.
This does not yet update all the workspace dependencies to be shared
between the listing and note preprocessors; it *only* integrates the
repo histories.
Instead of requiring a bunch of `<span>` wrangling, add a custom tag,
`<Listing>`, whose attributes get rewritten into the desired output
format, using `<figure>` and `<figcaption>` for improved semantic HTML.
Support both a default (nice and fancy) HTML output mode and a “simple”
mode to make it so we get the desired output format for the NoStarch
input files as well.
At some point we may want to include these in the workspace, but for
now they need to be excluded so `cargo build` and `rust-analyzer` work
correctly with the workspace layout.