Compare commits

...

3 Commits

Author SHA1 Message Date
Tom Milligan
b99630878f chore: fix clippy 2023-09-09 08:25:05 +01:00
Tom Milligan
7e774f4655 chore: prep v1.10.2 release (#116) 2023-08-07 18:58:32 +01:00
Tom Milligan
823cefbcbc fix: unlink mdbook internal toml dependency from mdbook-admonish (#115)
* chore: bump dependencies

* fix: unlink mdbook internal toml dependency from mdbook-admonish
2023-08-07 18:55:02 +01:00
5 changed files with 238 additions and 283 deletions

View File

@@ -2,6 +2,12 @@
## Unreleased
## 1.10.2
### Fixed
- Fixed `cargo install mdbook-admonish` failing due to an internal dependency mismatch with `mdbook` ([#115](https://github.com/tommilligan/mdbook-admonish/pull/115))
## 1.10.1
### Fixed

456
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
[package]
name = "mdbook-admonish"
version = "1.10.1"
version = "1.10.2"
edition = "2021"
authors = ["Tom Milligan <code@tommilligan.net>"]
@@ -22,22 +22,25 @@ name = "mdbook_admonish"
path = "src/lib.rs"
[dependencies]
anyhow = "1.0.65"
anyhow = "1.0.72"
clap = { version = "4", default_features = false, features = ["std", "derive"], optional = true }
env_logger = { version = "0.10", default_features = false, optional = true }
log = "0.4.17"
mdbook = "0.4.32"
once_cell = "1.15.0"
pulldown-cmark = "0.9.2"
regex = "1.6.0"
semver = "1.0.14"
serde = { version = "1.0.145", features = ["derive"] }
serde_json = "1.0.85"
toml = "0.7.3"
toml_edit = { version = "0.19.8", optional = true }
log = "0.4.19"
mdbook = "0.4.34"
once_cell = "1.18.0"
pulldown-cmark = "0.9.3"
regex = "1.9.3"
semver = "1.0.18"
serde = { version = "1.0.183", features = ["derive"] }
serde_json = "1.0.104"
# 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.7.6"
toml_edit = { version = "0.19.14", optional = true }
[dev-dependencies]
pretty_assertions = "1.3.0"
pretty_assertions = "1.4.0"
[features]
default = ["cli", "cli-install"]

View File

@@ -5,15 +5,17 @@ use std::collections::HashMap;
use crate::types::AdmonitionDefaults;
/// Loads the plugin configuration from mdbook internals.
///
/// 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: toml::Table = ctx
.config
.get_preprocessor("admonish")
.context("No configuration for mdbook-admonish in book.toml")?
.to_owned();
table
.try_into()
.context("Invalid mdbook-admonish configuration in book.toml")
let table: String = toml_mdbook::to_string(
ctx.config
.get_preprocessor("admonish")
.context("No configuration for mdbook-admonish in book.toml")?,
)?;
toml::from_str(&table).context("Invalid mdbook-admonish configuration in book.toml")
}
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]

View File

@@ -418,7 +418,7 @@ Will have bonus classnames
```
"#;
let expected = r##"
let expected = r#"
<div id="admonition-default" class="admonition note">
<div>
@@ -427,7 +427,7 @@ Will have bonus classnames
</div>
</div>
"##;
"#;
assert_eq!(expected, prep(content));
}
@@ -684,7 +684,7 @@ A simple admonition.
Text
"#;
let expected = r##"# Chapter
let expected = r#"# Chapter
<div id="admonition-default" class="admonition note">
<div>
@@ -694,7 +694,7 @@ A simple admonition.
</div>
</div>
Text
"##;
"#;
let preprocess_result = preprocess(
content,
@@ -718,7 +718,7 @@ A simple admonition.
Text
"#;
let expected = r##"# Chapter
let expected = r#"# Chapter
<div id="admonition-default" class="admonition note">
<div>
@@ -728,7 +728,7 @@ A simple admonition.
</div>
</div>
Text
"##;
"#;
assert_eq!(expected, prep(content));
}