tommilligan / mdbook-admonish

A preprocessor for mdbook to add Material Design admonishments.
MIT License
175 stars 20 forks source link

remove serde kebab-case renaming for AdmonitionDefaults struct #173

Closed yannickseurin closed 5 months ago

yannickseurin commented 6 months ago

The AdmonitionDefaults struct has an attribute to rename all fields in kebab case:

#[serde(rename_all = "kebab-case")]
pub(crate) struct AdmonitionDefaults {
    #[serde(default)]
    pub(crate) title: Option<String>,

    #[serde(default)]
    pub(crate) collapsible: bool,

    #[serde(default)]
    pub(crate) css_id_prefix: Option<String>,
}

This means that the css_id_prefix field must actually be declared as css-id-prefix in the book.toml file. This is confusing because it is inconsistent with:

tommilligan commented 5 months ago

Hi @yannickseurin, thanks for the your contribution and for using mdbook-admonish.

Definitely agree this is the right behaviour to adopt. I've added back-compatibility so as to not break existing functionality (css-id-prefix will continue to work, but css_id_prefix will be used by default). Also added some missing unit tests to catch this type of issue in the future.

Thanks again for taking the time to fix this!