mirror of
https://github.com/tommilligan/mdbook-admonish.git
synced 2025-12-28 09:06:13 -05:00
Compare commits
7 Commits
readme-exa
...
upgrade-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0c4d3764e | ||
|
|
a942a8094e | ||
|
|
d10a427b0f | ||
|
|
41a3b05094 | ||
|
|
d0f73baa3f | ||
|
|
4c40418090 | ||
|
|
30c9ad2269 |
111
Cargo.lock
generated
111
Cargo.lock
generated
@@ -86,9 +86,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-query"
|
||||
version = "1.0.3"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5"
|
||||
checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391"
|
||||
dependencies = [
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
@@ -194,9 +194,9 @@ checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.98"
|
||||
version = "1.0.99"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f"
|
||||
checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
@@ -218,9 +218,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.5.4"
|
||||
version = "4.5.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0"
|
||||
checksum = "5db83dced34638ad474f39f250d7fea9598bdd239eaced1bdf45d597da0f433f"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
@@ -228,9 +228,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.5.2"
|
||||
version = "4.5.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4"
|
||||
checksum = "f7e204572485eb3fbf28f871612191521df159bc3e15a9f5064c66dba3a8c05f"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
@@ -241,18 +241,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap_complete"
|
||||
version = "4.5.2"
|
||||
version = "4.5.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd79504325bf38b10165b02e89b4347300f855f273c4cb30c4a3209e6583275e"
|
||||
checksum = "fbca90c87c2a04da41e95d1856e8bcd22f159bdbfa147314d2ce5218057b0e58"
|
||||
dependencies = [
|
||||
"clap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "4.5.4"
|
||||
version = "4.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64"
|
||||
checksum = "c780290ccf4fb26629baa7a1081e68ced113f1d3ec302fa5948f1c381ebf06c6"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
@@ -262,9 +262,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "0.7.0"
|
||||
version = "0.7.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce"
|
||||
checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70"
|
||||
|
||||
[[package]]
|
||||
name = "colorchoice"
|
||||
@@ -289,9 +289,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-channel"
|
||||
version = "0.5.12"
|
||||
version = "0.5.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95"
|
||||
checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2"
|
||||
dependencies = [
|
||||
"crossbeam-utils",
|
||||
]
|
||||
@@ -317,9 +317,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.19"
|
||||
version = "0.8.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345"
|
||||
checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
|
||||
|
||||
[[package]]
|
||||
name = "crypto-common"
|
||||
@@ -705,9 +705,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "httparse"
|
||||
version = "1.8.0"
|
||||
version = "1.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"
|
||||
checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9"
|
||||
|
||||
[[package]]
|
||||
name = "httpdate"
|
||||
@@ -723,9 +723,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
||||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "0.14.28"
|
||||
version = "0.14.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80"
|
||||
checksum = "f361cde2f109281a220d4307746cdfd5ee3f410da58a70377762396775634b33"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
@@ -983,16 +983,15 @@ dependencies = [
|
||||
"semver",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"toml 0.5.11",
|
||||
"toml 0.8.13",
|
||||
"toml 0.8.14",
|
||||
"toml_edit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.7.2"
|
||||
version = "2.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
|
||||
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
||||
|
||||
[[package]]
|
||||
name = "mime"
|
||||
@@ -1124,9 +1123,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot"
|
||||
version = "0.12.2"
|
||||
version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb"
|
||||
checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
|
||||
dependencies = [
|
||||
"lock_api",
|
||||
"parking_lot_core",
|
||||
@@ -1327,9 +1326,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.82"
|
||||
version = "1.0.85"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b"
|
||||
checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
@@ -1430,9 +1429,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.10.4"
|
||||
version = "1.10.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c"
|
||||
checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
@@ -1442,9 +1441,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.6"
|
||||
version = "0.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea"
|
||||
checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
@@ -1453,9 +1452,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.8.3"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
|
||||
checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-demangle"
|
||||
@@ -1511,18 +1510,18 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.202"
|
||||
version = "1.0.203"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395"
|
||||
checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.202"
|
||||
version = "1.0.203"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838"
|
||||
checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -1654,9 +1653,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.64"
|
||||
version = "2.0.66"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ad3dee41f36859875573074334c200d1add8e4a87bb37113ebd31d926b7b11f"
|
||||
checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -1733,9 +1732,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.37.0"
|
||||
version = "1.38.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787"
|
||||
checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes",
|
||||
@@ -1750,9 +1749,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio-macros"
|
||||
version = "2.2.0"
|
||||
version = "2.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
|
||||
checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -1795,9 +1794,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.8.13"
|
||||
version = "0.8.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4e43f8cc456c9704c851ae29c67e17ef65d2c30017c17a9765b89c382dc8bba"
|
||||
checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_spanned",
|
||||
@@ -1816,9 +1815,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "toml_edit"
|
||||
version = "0.22.13"
|
||||
version = "0.22.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c127785850e8c20836d49732ae6abfa47616e60bf9d9f57c43c250361a9db96c"
|
||||
checksum = "f21c7aaf97f1bd9ca9d4f9e73b0a6c74bd5afef56f2bc931943a6e1c37e04e38"
|
||||
dependencies = [
|
||||
"indexmap",
|
||||
"serde",
|
||||
@@ -1934,9 +1933,9 @@ checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6"
|
||||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "2.5.0"
|
||||
version = "2.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633"
|
||||
checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c"
|
||||
dependencies = [
|
||||
"form_urlencoded",
|
||||
"idna",
|
||||
@@ -1951,9 +1950,9 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
|
||||
|
||||
[[package]]
|
||||
name = "utf8parse"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
||||
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
@@ -2249,9 +2248,9 @@ checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.6.8"
|
||||
version = "0.6.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3c52e9c97a68071b23e836c9380edae937f17b9c4667bd021973efc689f618d"
|
||||
checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
26
Cargo.toml
26
Cargo.toml
@@ -26,27 +26,23 @@ name = "mdbook_admonish"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.75"
|
||||
anyhow = "1.0.86"
|
||||
# Note: clap 4.4 increases MSRV to 1.70.0 (2023-06-01)
|
||||
# To use MSRV supported dependencies, install using the lockfile with
|
||||
# `cargo install mdbook-admonish --locked`
|
||||
clap = { version = "4.3", default-features = false, features = ["std", "derive"], optional = true }
|
||||
clap = { version = "4.5", default-features = false, features = ["std", "derive"], optional = true }
|
||||
env_logger = { version = "0.11", default-features = false, optional = true }
|
||||
log = "0.4.20"
|
||||
mdbook = "0.4.35"
|
||||
once_cell = "1.18.0"
|
||||
log = "0.4.21"
|
||||
mdbook = "0.4.40"
|
||||
once_cell = "1.19.0"
|
||||
path-slash = "0.2.1"
|
||||
pulldown-cmark = "0.11"
|
||||
regex = "1.9.6"
|
||||
semver = "1.0.19"
|
||||
serde = { version = "1.0.188", features = ["derive"] }
|
||||
serde_json = "1.0.107"
|
||||
# Peer dependency of mdbook
|
||||
# The version of toml that mdbook uses internally (and uses in it's public api)
|
||||
# Only used for compatilibilty with the mdbook public api
|
||||
toml_mdbook = { package = "toml", version = "0.5.11" }
|
||||
toml = "0.8.1"
|
||||
toml_edit = { version = "0.22.13", optional = true }
|
||||
regex = "1.10.5"
|
||||
semver = "1.0.23"
|
||||
serde = { version = "1.0.203", features = ["derive"] }
|
||||
serde_json = "1.0.117"
|
||||
toml = "0.8.14"
|
||||
toml_edit = { version = "0.22.14", optional = true }
|
||||
hex_color = { version = "3.0.0", features = ["serde"] }
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
@@ -1,41 +1,49 @@
|
||||
<h1 id="chapter-1"><a class="header" href="#chapter-1">Chapter 1</a></h1>
|
||||
<div id="admonition-what-is-this" class="admonition admonish-abstract">
|
||||
<div id="admonition-what-is-this" class="admonition admonish-abstract" role="note" aria-labelledby="admonition-what-is-this-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-what-is-this-title">
|
||||
<p>What <i>is</i> this?</p>
|
||||
<p><a class="admonition-anchor-link" href="#admonition-what-is-this"></a></p>
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-what-is-this"></a>
|
||||
</div>
|
||||
<div>
|
||||
<p>This book acts as an integration test for <code>mdbook-admonish</code>.</p>
|
||||
<p>It verifies that <code>mdbook</code> post-processes our generated HTML in the way we expect.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="admonition-note" class="admonition admonish-note">
|
||||
<div id="admonition-note" class="admonition admonish-note" role="note" aria-labelledby="admonition-note-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-note-title">
|
||||
<p>Note</p>
|
||||
<p><a class="admonition-anchor-link" href="#admonition-note"></a></p>
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-note"></a>
|
||||
</div>
|
||||
<div>
|
||||
<p>Simples</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="admonition-frog" class="admonition admonish-frog">
|
||||
<div id="admonition-frog" class="admonition admonish-frog" role="note" aria-labelledby="admonition-frog-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-frog-title">
|
||||
<p>Frog</p>
|
||||
<p><a class="admonition-anchor-link" href="#admonition-frog"></a></p>
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-frog"></a>
|
||||
</div>
|
||||
<div>
|
||||
<p>Custom frog directive</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="admonition-default" class="admonition admonish-warning">
|
||||
<div id="admonition-default" class="admonition admonish-warning" role="note">
|
||||
<div>
|
||||
<p>No title, only body</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="admonition-error-rendering-admonishment" class="admonition admonish-bug">
|
||||
<div id="admonition-error-rendering-admonishment" class="admonition admonish-bug" role="note" aria-labelledby="admonition-error-rendering-admonishment-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-error-rendering-admonishment-title">
|
||||
<p>Error rendering admonishment</p>
|
||||
<p><a class="admonition-anchor-link" href="#admonition-error-rendering-admonishment"></a></p>
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-error-rendering-admonishment"></a>
|
||||
</div>
|
||||
<div>
|
||||
<p>Failed with:</p>
|
||||
@@ -55,38 +63,46 @@ No title, only body
|
||||
</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
<details id="admonition-note-1" class="admonition admonish-note">
|
||||
<details id="admonition-note-1" class="admonition admonish-note" role="note" aria-labelledby="admonition-note-1-title">
|
||||
<summary class="admonition-title">
|
||||
<div id="admonition-note-1-title">
|
||||
<p>Note</p>
|
||||
<p><a class="admonition-anchor-link" href="#admonition-note-1"></a></p>
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-note-1"></a>
|
||||
</summary>
|
||||
<div>
|
||||
<p>Hidden on load</p>
|
||||
</div>
|
||||
</details>
|
||||
<div id="admonition-warning" class="admonition admonish-warning">
|
||||
<div id="admonition-warning" class="admonition admonish-warning" role="note" aria-labelledby="admonition-warning-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-warning-title">
|
||||
<p>Warning</p>
|
||||
<p><a class="admonition-anchor-link" href="#admonition-warning"></a></p>
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-warning"></a>
|
||||
</div>
|
||||
<div>
|
||||
<p>This is a commonly shared warning!</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="admonition-note-2" class="admonition admonish-note">
|
||||
<div id="admonition-note-2" class="admonition admonish-note" role="note" aria-labelledby="admonition-note-2-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-note-2-title">
|
||||
<p>Note</p>
|
||||
<p><a class="admonition-anchor-link" href="#admonition-note-2"></a></p>
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-note-2"></a>
|
||||
</div>
|
||||
<div>
|
||||
<pre><code class="language-bash">Nested code block
|
||||
</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
<div id="admonition-note-3" class="admonition admonish-note">
|
||||
<div id="admonition-note-3" class="admonition admonish-note" role="note" aria-labelledby="admonition-note-3-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-note-3-title">
|
||||
<p>Note</p>
|
||||
<p><a class="admonition-anchor-link" href="#admonition-note-3"></a></p>
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-note-3"></a>
|
||||
</div>
|
||||
<div>
|
||||
<pre><pre class="playground"><code class="language-rust"><span class="boring">#![allow(unused)]
|
||||
@@ -110,10 +126,12 @@ let x = 20;
|
||||
</li>
|
||||
<li>
|
||||
<p>Thing two</p>
|
||||
<div id="admonition-note-4" class="admonition admonish-note">
|
||||
<div id="admonition-note-4" class="admonition admonish-note" role="note" aria-labelledby="admonition-note-4-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-note-4-title">
|
||||
<p>Note</p>
|
||||
<p><a class="admonition-anchor-link" href="#admonition-note-4"></a></p>
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-note-4"></a>
|
||||
</div>
|
||||
<div>
|
||||
<p>Thing two</p>
|
||||
|
||||
@@ -125,7 +125,7 @@ struct Preprocessors {
|
||||
|
||||
/// Load the plugin specific config as a toml string, for private deserialization.
|
||||
fn admonish_config_string(config: &Config) -> Result<String> {
|
||||
Ok(toml_mdbook::to_string(
|
||||
Ok(toml::to_string(
|
||||
&config
|
||||
.preprocessor
|
||||
.admonish
|
||||
|
||||
@@ -11,11 +11,12 @@ use crate::types::{AdmonitionDefaults, BuiltinDirective, BuiltinDirectiveConfig}
|
||||
/// Roundtrips config to string, to avoid linking the plugin's internal version of toml
|
||||
/// to the one publically exposed by the mdbook library.
|
||||
pub(crate) fn admonish_config_from_context(ctx: &PreprocessorContext) -> Result<Config> {
|
||||
let table: String = toml_mdbook::to_string(
|
||||
let table: String = toml::to_string(
|
||||
ctx.config
|
||||
.get_preprocessor("admonish")
|
||||
.context("No configuration for mdbook-admonish in book.toml")?,
|
||||
)?;
|
||||
)
|
||||
.context("Could not serialize mdbook-admonish config. This is a bug in the toml library.")?;
|
||||
admonish_config_from_str(&table)
|
||||
}
|
||||
|
||||
|
||||
@@ -155,11 +155,13 @@ Text
|
||||
|
||||
let expected = r##"# Chapter
|
||||
|
||||
<div id="admonition-note" class="admonition admonish-note">
|
||||
<div id="admonition-note" class="admonition admonish-note" role="note" aria-labelledby="admonition-note-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-note-title">
|
||||
|
||||
Note
|
||||
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-note"></a>
|
||||
</div>
|
||||
<div>
|
||||
@@ -187,11 +189,13 @@ Text
|
||||
|
||||
let expected = r##"# Chapter
|
||||
|
||||
<div id="admonition-note" class="admonition admonish-note">
|
||||
<div id="admonition-note" class="admonition admonish-note" role="note" aria-labelledby="admonition-note-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-note-title">
|
||||
|
||||
Note
|
||||
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-note"></a>
|
||||
</div>
|
||||
<div>
|
||||
@@ -219,11 +223,13 @@ Text
|
||||
|
||||
let expected = r##"# Chapter
|
||||
|
||||
<div id="admonition-warning" class="admonition admonish-warning">
|
||||
<div id="admonition-warning" class="admonition admonish-warning" role="note" aria-labelledby="admonition-warning-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-warning-title">
|
||||
|
||||
Warning
|
||||
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-warning"></a>
|
||||
</div>
|
||||
<div>
|
||||
@@ -249,11 +255,13 @@ Text
|
||||
|
||||
let expected = r##"# Chapter
|
||||
|
||||
<div id="admonition-caution" class="admonition admonish-warning">
|
||||
<div id="admonition-caution" class="admonition admonish-warning" role="note" aria-labelledby="admonition-caution-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-caution-title">
|
||||
|
||||
Caution
|
||||
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-caution"></a>
|
||||
</div>
|
||||
<div>
|
||||
@@ -279,11 +287,13 @@ Text
|
||||
|
||||
let expected = r##"# Chapter
|
||||
|
||||
<div id="admonition-read-this" class="admonition admonish-warning">
|
||||
<div id="admonition-read-this" class="admonition admonish-warning" role="note" aria-labelledby="admonition-read-this-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-read-this-title">
|
||||
|
||||
Read **this**!
|
||||
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-read-this"></a>
|
||||
</div>
|
||||
<div>
|
||||
@@ -373,11 +383,13 @@ hello
|
||||
|
||||
let expected = r##"
|
||||
|
||||
<div id="admonition-and-in-the-title" class="admonition admonish-note">
|
||||
<div id="admonition-and-in-the-title" class="admonition admonish-note" role="note" aria-labelledby="admonition-and-in-the-title-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-and-in-the-title-title">
|
||||
|
||||
And "<i>in</i>" the title
|
||||
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-and-in-the-title"></a>
|
||||
</div>
|
||||
<div>
|
||||
@@ -403,11 +415,13 @@ hello
|
||||
|
||||
let expected = r##"
|
||||
|
||||
<div id="admonition-trademark" class="admonition admonish-warning">
|
||||
<div id="admonition-trademark" class="admonition admonish-warning" role="note" aria-labelledby="admonition-trademark-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-trademark-title">
|
||||
|
||||
Trademark™
|
||||
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-trademark"></a>
|
||||
</div>
|
||||
<div>
|
||||
@@ -432,11 +446,13 @@ Will have bonus classnames
|
||||
|
||||
let expected = r##"
|
||||
|
||||
<div id="admonition-tip" class="admonition admonish-tip my-style other-style">
|
||||
<div id="admonition-tip" class="admonition admonish-tip my-style other-style" role="note" aria-labelledby="admonition-tip-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-tip-title">
|
||||
|
||||
Tip
|
||||
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-tip"></a>
|
||||
</div>
|
||||
<div>
|
||||
@@ -460,11 +476,13 @@ Will have bonus classnames
|
||||
|
||||
let expected = r##"
|
||||
|
||||
<div id="admonition-developers-dont-want-you-to-know-this-one-weird-tip" class="admonition admonish-tip my-style other-style">
|
||||
<div id="admonition-developers-dont-want-you-to-know-this-one-weird-tip" class="admonition admonish-tip my-style other-style" role="note" aria-labelledby="admonition-developers-dont-want-you-to-know-this-one-weird-tip-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-developers-dont-want-you-to-know-this-one-weird-tip-title">
|
||||
|
||||
Developers don't want you to know this one weird tip!
|
||||
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-developers-dont-want-you-to-know-this-one-weird-tip"></a>
|
||||
</div>
|
||||
<div>
|
||||
@@ -487,7 +505,7 @@ Will have bonus classnames
|
||||
|
||||
let expected = r#"
|
||||
|
||||
<div id="admonition-default" class="admonition admonish-note">
|
||||
<div id="admonition-default" class="admonition admonish-note" role="note">
|
||||
<div>
|
||||
|
||||
|
||||
@@ -513,11 +531,13 @@ Content one.
|
||||
|
||||
let expected = r##"
|
||||
|
||||
<div id="admonition-my-note" class="admonition admonish-note">
|
||||
<div id="admonition-my-note" class="admonition admonish-note" role="note" aria-labelledby="admonition-my-note-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-my-note-title">
|
||||
|
||||
My Note
|
||||
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-my-note"></a>
|
||||
</div>
|
||||
<div>
|
||||
@@ -528,11 +548,13 @@ Content zero.
|
||||
</div>
|
||||
|
||||
|
||||
<div id="admonition-my-note-1" class="admonition admonish-note">
|
||||
<div id="admonition-my-note-1" class="admonition admonish-note" role="note" aria-labelledby="admonition-my-note-1-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-my-note-1-title">
|
||||
|
||||
My Note
|
||||
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-my-note-1"></a>
|
||||
</div>
|
||||
<div>
|
||||
@@ -556,11 +578,13 @@ Bonus content!
|
||||
|
||||
let expected = r##"
|
||||
|
||||
<div id="admonition-article-heading" class="admonition admonish-tip my other-style">
|
||||
<div id="admonition-article-heading" class="admonition admonish-tip my other-style" role="note" aria-labelledby="admonition-article-heading-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-article-heading-title">
|
||||
|
||||
Article Heading
|
||||
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-article-heading"></a>
|
||||
</div>
|
||||
<div>
|
||||
@@ -584,11 +608,13 @@ Bonus content!
|
||||
|
||||
let expected = r##"
|
||||
|
||||
<div id="admonition-error-rendering-admonishment" class="admonition admonish-bug">
|
||||
<div id="admonition-error-rendering-admonishment" class="admonition admonish-bug" role="note" aria-labelledby="admonition-error-rendering-admonishment-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-error-rendering-admonishment-title">
|
||||
|
||||
Error rendering admonishment
|
||||
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-error-rendering-admonishment"></a>
|
||||
</div>
|
||||
<div>
|
||||
@@ -686,11 +712,13 @@ Hidden
|
||||
|
||||
let expected = r##"
|
||||
|
||||
<details id="admonition-note" class="admonition admonish-note">
|
||||
<details id="admonition-note" class="admonition admonish-note" role="note" aria-labelledby="admonition-note-title">
|
||||
<summary class="admonition-title">
|
||||
<div id="admonition-note-title">
|
||||
|
||||
Note
|
||||
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-note"></a>
|
||||
</summary>
|
||||
<div>
|
||||
@@ -715,11 +743,13 @@ Text
|
||||
|
||||
let expected = r##"# Chapter
|
||||
|
||||
<div id="admonition-admonish" class="admonition admonish-note">
|
||||
<div id="admonition-admonish" class="admonition admonish-note" role="note" aria-labelledby="admonition-admonish-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-admonish-title">
|
||||
|
||||
Admonish
|
||||
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-admonish"></a>
|
||||
</div>
|
||||
<div>
|
||||
@@ -759,7 +789,7 @@ Text
|
||||
|
||||
let expected = r#"# Chapter
|
||||
|
||||
<div id="admonition-default" class="admonition admonish-note">
|
||||
<div id="admonition-default" class="admonition admonish-note" role="note">
|
||||
<div>
|
||||
|
||||
A simple admonition.
|
||||
@@ -797,7 +827,7 @@ Text
|
||||
|
||||
let expected = r#"# Chapter
|
||||
|
||||
<div id="admonition-default" class="admonition admonish-note">
|
||||
<div id="admonition-default" class="admonition admonish-note" role="note">
|
||||
<div>
|
||||
|
||||
A simple admonition.
|
||||
@@ -821,11 +851,13 @@ Text
|
||||
|
||||
let expected = r##"# Chapter
|
||||
|
||||
<div id="yay-custom-id" class="admonition admonish-success">
|
||||
<div id="yay-custom-id" class="admonition admonish-success" role="note" aria-labelledby="yay-custom-id-title">
|
||||
<div class="admonition-title">
|
||||
<div id="yay-custom-id-title">
|
||||
|
||||
Check
|
||||
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#yay-custom-id"></a>
|
||||
</div>
|
||||
<div>
|
||||
@@ -851,11 +883,13 @@ Text
|
||||
|
||||
let expected = r##"# Chapter
|
||||
|
||||
<div id="admonition-check" class="admonition admonish-success">
|
||||
<div id="admonition-check" class="admonition admonish-success" role="note" aria-labelledby="admonition-check-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-check-title">
|
||||
|
||||
Check
|
||||
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-check"></a>
|
||||
</div>
|
||||
<div>
|
||||
@@ -881,11 +915,13 @@ Text
|
||||
|
||||
let expected = r##"# Chapter
|
||||
|
||||
<div id="admonition-check-mark" class="admonition admonish-success">
|
||||
<div id="admonition-check-mark" class="admonition admonish-success" role="note" aria-labelledby="admonition-check-mark-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-check-mark-title">
|
||||
|
||||
Check Mark
|
||||
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-check-mark"></a>
|
||||
</div>
|
||||
<div>
|
||||
@@ -914,11 +950,13 @@ Text
|
||||
|
||||
let expected = r##"# Chapter
|
||||
|
||||
<div id="admonition-check-mark" class="admonition admonish-success">
|
||||
<div id="admonition-check-mark" class="admonition admonish-success" role="note" aria-labelledby="admonition-check-mark-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-check-mark-title">
|
||||
|
||||
Check <span class="emphasis">Mark</span>
|
||||
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-check-mark"></a>
|
||||
</div>
|
||||
<div>
|
||||
@@ -944,11 +982,13 @@ Text
|
||||
|
||||
let expected = r##"# Chapter
|
||||
|
||||
<div id="info" class="admonition admonish-info">
|
||||
<div id="info" class="admonition admonish-info" role="note" aria-labelledby="info-title">
|
||||
<div class="admonition-title">
|
||||
<div id="info-title">
|
||||
|
||||
Info
|
||||
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#info"></a>
|
||||
</div>
|
||||
<div>
|
||||
@@ -988,11 +1028,13 @@ Text
|
||||
|
||||
let expected = r##"# Chapter
|
||||
|
||||
<div id="prefix-my-title" class="admonition admonish-info">
|
||||
<div id="prefix-my-title" class="admonition admonish-info" role="note" aria-labelledby="prefix-my-title-title">
|
||||
<div class="admonition-title">
|
||||
<div id="prefix-my-title-title">
|
||||
|
||||
My Title
|
||||
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#prefix-my-title"></a>
|
||||
</div>
|
||||
<div>
|
||||
@@ -1032,11 +1074,13 @@ Text
|
||||
|
||||
let expected = r##"# Chapter
|
||||
|
||||
<div id="my-section-id" class="admonition admonish-info">
|
||||
<div id="my-section-id" class="admonition admonish-info" role="note" aria-labelledby="my-section-id-title">
|
||||
<div class="admonition-title">
|
||||
<div id="my-section-id-title">
|
||||
|
||||
My Title
|
||||
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#my-section-id"></a>
|
||||
</div>
|
||||
<div>
|
||||
@@ -1099,11 +1143,13 @@ Text
|
||||
1. Thing two
|
||||
|
||||
|
||||
<div id="admonition-note" class="admonition admonish-note">
|
||||
<div id="admonition-note" class="admonition admonish-note" role="note" aria-labelledby="admonition-note-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-note-title">
|
||||
|
||||
Note
|
||||
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-note"></a>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@@ -178,11 +178,13 @@ x = 20;
|
||||
"#;
|
||||
let expected_content = r##"
|
||||
|
||||
<div id="admonition-title" class="admonition admonish-note">
|
||||
<div id="admonition-title" class="admonition admonish-note" role="note" aria-labelledby="admonition-title-title">
|
||||
<div class="admonition-title">
|
||||
<div id="admonition-title-title">
|
||||
|
||||
Title
|
||||
|
||||
</div>
|
||||
<a class="admonition-anchor-link" href="#admonition-title"></a>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@@ -35,9 +35,9 @@ impl<'a> Admonition<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn html(&self, id_counter: &mut HashMap<String, usize>) -> String {
|
||||
pub(crate) fn html(self, id_counter: &mut HashMap<String, usize>) -> String {
|
||||
let anchor_id = match &self.css_id {
|
||||
CssId::Verbatim(id) => Cow::Borrowed(id),
|
||||
CssId::Verbatim(id) => Cow::Borrowed(id.as_str()),
|
||||
CssId::Prefix(prefix) => {
|
||||
let id = unique_id_from_content(
|
||||
if !self.title.is_empty() {
|
||||
@@ -56,53 +56,77 @@ impl<'a> Admonition<'a> {
|
||||
let content = &self.content;
|
||||
let indent = " ".repeat(self.indent);
|
||||
|
||||
let title_block = if self.collapsible { "summary" } else { "div" };
|
||||
|
||||
let title_html = if !title.is_empty() {
|
||||
Cow::Owned(format!(
|
||||
r##"{indent}<{title_block} class="admonition-title">
|
||||
let (titlebar_html, title_id) = if !title.is_empty() {
|
||||
let titlebar_element = if self.collapsible { "summary" } else { "div" };
|
||||
let title_id = format!("{anchor_id}-title");
|
||||
let titlebar_html = Cow::Owned(format!(
|
||||
r##"{indent}<{titlebar_element} class="admonition-title">
|
||||
{indent}<div id="{title_id}">
|
||||
{indent}
|
||||
{indent}{title}
|
||||
{indent}
|
||||
{indent}</div>
|
||||
{indent}<a class="admonition-anchor-link" href="#{anchor_id}"></a>
|
||||
{indent}</{title_block}>
|
||||
{indent}</{titlebar_element}>
|
||||
"##
|
||||
))
|
||||
));
|
||||
(titlebar_html, Some(title_id))
|
||||
} else {
|
||||
Cow::Borrowed("")
|
||||
(Cow::Borrowed(""), None)
|
||||
};
|
||||
|
||||
let mut additional_class = format!("admonish-{}", self.directive);
|
||||
if !self.additional_classnames.is_empty() {
|
||||
for additional_classname in &self.additional_classnames {
|
||||
additional_class.push(' ');
|
||||
additional_class.push_str(additional_classname);
|
||||
}
|
||||
}
|
||||
let mut classes = vec![
|
||||
"admonition".to_owned(),
|
||||
format!("admonish-{}", self.directive),
|
||||
];
|
||||
classes.extend(self.additional_classnames);
|
||||
let classes = classes.join(" ");
|
||||
|
||||
let admonition_block = if self.collapsible { "details" } else { "div" };
|
||||
let mut attributes = vec![
|
||||
("id", anchor_id),
|
||||
("class", Cow::Owned(classes)),
|
||||
("role", Cow::Borrowed("note")),
|
||||
];
|
||||
if let Some(title_id) = title_id {
|
||||
attributes.push(("aria-labelledby", Cow::Owned(title_id)));
|
||||
}
|
||||
let attributes = join_attributes(&attributes);
|
||||
|
||||
let admonition_element = if self.collapsible { "details" } else { "div" };
|
||||
// Notes on the HTML template:
|
||||
// - the additional whitespace around the content are deliberate
|
||||
// In line with the commonmark spec, this allows the inner content to be
|
||||
// rendered as markdown paragraphs.
|
||||
format!(
|
||||
r#"
|
||||
{indent}<{admonition_block} id="{anchor_id}" class="admonition {additional_class}">
|
||||
{title_html}{indent}<div>
|
||||
{indent}<{admonition_element} {attributes}>
|
||||
{titlebar_html}{indent}<div>
|
||||
{indent}
|
||||
{indent}{content}
|
||||
{indent}
|
||||
{indent}</div>
|
||||
{indent}</{admonition_block}>"#,
|
||||
{indent}</{admonition_element}>"#,
|
||||
)
|
||||
}
|
||||
|
||||
/// Strips all admonish syntax, leaving the plain content of the block.
|
||||
pub(crate) fn strip(&self) -> String {
|
||||
pub(crate) fn strip(self) -> String {
|
||||
// Add in newlines to preserve line numbering for test output
|
||||
// These replace the code fences we stripped out
|
||||
format!("\n{}\n", self.content)
|
||||
}
|
||||
}
|
||||
|
||||
fn join_attributes(attributes: &[(impl AsRef<str>, impl AsRef<str>)]) -> String {
|
||||
let mut buffer = String::new();
|
||||
for (key, value) in attributes {
|
||||
buffer.push_str(key.as_ref());
|
||||
buffer.push_str(r#"=""#);
|
||||
buffer.push_str(value.as_ref());
|
||||
buffer.push_str(r#"" "#);
|
||||
}
|
||||
buffer.pop();
|
||||
buffer
|
||||
}
|
||||
|
||||
const ANCHOR_ID_DEFAULT: &str = "default";
|
||||
|
||||
Reference in New Issue
Block a user