Skip to content

YAML config works but TOML equivalent does not (issue with pymdownx.blocks.tab slugify setting) #483

@liWanr

Description

@liWanr

Bug description

When using YAML as the project configuration file, the following setup works as expected:

- pymdownx.blocks.tab:          # New: content tabs
      alternate_style: True
      combine_header_slug: True
      slugify: !!python/object/apply:pymdownx.slugs.slugify {kwds: {case: lower}}

However, when switching to TOML, the same logic no longer works:

[project.markdown_extensions.pymdownx.blocks.tab]           # New: content tabs
alternate_style = true
combine_header_slug = true

[project.markdown_extensions.pymdownx.blocks.tab.slugify]
object = "pymdownx.slugs.slugify"
kwds = { case = "lower" }

I suspect this might be because YAML can create an instance using !!python/object/apply, while TOML cannot. If so, is there any recommended workaround or alternative approach to work properly with TOML?

Additionally, could it be that when using TOML as the project configuration file, the framework performs some internal handling or conversion for other similar slug functions?

For example:

[project.markdown_extensions.pymdownx.tabbed.slugify]
object = "pymdownx.slugs.slugify"
kwds = { case = "lower" }

Related links

Reproduction

reproduction.tar.gz

Steps to reproduce

  1. run the project and check the link anchors. Since the YAML configuration file is being used, you’ll notice that the anchors correspond directly to the tab values.

  2. comment out the YAML configuration and rename zensical-o.toml to zensical.toml. After restarting, check the anchors again — you’ll see that they are now formatted like tab_1_1 instead.

Browser

Chrome

Before submitting

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue reports a bugresolvedIssue is resolved, yet unreleased if open

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions