Python-Markdown / markdown

A Python implementation of John Gruber’s Markdown with Extension support.
https://python-markdown.github.io/
BSD 3-Clause "New" or "Revised" License
3.79k stars 863 forks source link

Update documentation in file `toc.md` in `slugify` part. #1306

Closed redlovv closed 1 year ago

redlovv commented 1 year ago

Hello!

This pr fixes a bug in the documentation in file toc.md in slugify part.

If I use the setting as indicated in the documentation (markdown.extensions.headerid.slugify), then I get an error:

Error: MkDocs encountered an error parsing the configuration file: while constructing a Python object
cannot find module 'markdown.extensions.headerid' (No module named 'markdown.extensions.headerid')

Because this function slugify_unicode is moved to the module markdown.extensions.toc.

P.S. Do you think it's worth putting a hint in the documentation that this setting should be used in conjunction with !!python/name:? Like this:

markdown_extensions:
  - toc:
      slugify: !!python/name:markdown.extensions.toc.slugify_unicode
waylan commented 1 year ago

Do you think it's worth putting a hint in the documentation that this setting should be used in conjunction with !!python/name:?

No. That is specific to YAML configuration files which are used by MkDocs. Python-Markdown is used in a lot of other contexts in which that does not apply.