mirror of
https://github.com/rust-lang/book.git
synced 2026-12-01 16:06:05 -06:00
d098a33cb7d2198c659ba43e815a3281076065ec
rewrite into an mdBook preprocessor
- Rework the `rewrite` function to spit back out Markdown instead of going all the way to HTML. - Implement the `Preprocessor` type and wire up a CLI conforming to the mdBook preprocessor spec. - Add relevant deps, including for an integration test.
mdbook-simple-note-preprocessor
This is a very simple preprocessor for mdBook which takes Markdown like this—
> Note: This is some material we want to provide more emphasis for, because it
> is important in some way!
—and produces output roughly like this:
<section class="note" aria-label="Note" aria-role="note">
<p>
This is some material we want to provide more emphasis for, because it is
important in some way!
</p>
</section>
This allows using the relatively standard Markdown convention of (incorrectly!) using blockquotes for “callouts” or “notes” like this, while still producing semantic HTML which conveys the actual intent.
Note
This is not a full “admonition” preprocessor, and it is not remotely compliant with the GitHub “alert” syntax. It exists almost entirely for the sake of providing better semantic HTML for The Rust Programming Language book with a minimum of disruption to existing workflows!
You are probably better off using one of the other existing alert/admonition preprocessors:
Languages
Rust
88.6%
XSLT
5%
Shell
2.9%
HTML
2.2%
JavaScript
0.8%
Other
0.5%