Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove serde kebab-case renaming for AdmonitionDefaults struct #173

Merged
merged 2 commits into from
May 19, 2024

Conversation

yannickseurin
Copy link
Contributor

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:

  • the doc (e.g. here)
  • the naming convention of other fields such as on_failure and render_mode.

@tommilligan
Copy link
Owner

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!

@tommilligan tommilligan merged commit f04016d into tommilligan:main May 19, 2024
6 checks passed
@yannickseurin yannickseurin deleted the snake-case branch May 21, 2024 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants