Giter Site home page Giter Site logo

Comments (5)

squidfunk avatar squidfunk commented on June 12, 2024 1

Oops, yes, there was another error related to the refactoring. I opened a PR which fixes the problem for the reproduction #3694, but it might still be necessary to change the slugify function to something else.

from mkdocs.

pawamoy avatar pawamoy commented on June 12, 2024

Thank you, I was able to confirm the issue. I've edited the title accordingly.

It's possibly related to the changes made in #3649. @squidfunk could you take a look?

from mkdocs.

pawamoy avatar pawamoy commented on June 12, 2024

Here's a small repro. Extract it, create a venv, install mkdocs, serve, and observe behavior by clicking on the Section 3 dropdown.

repro3691.zip

from mkdocs.

squidfunk avatar squidfunk commented on June 12, 2024

Here's what's happening: the slugify function that is used by toc.slugify seems to filter all characters out (as it only seems to keep ASCII), resulting in an "" (empty string) anchor. This leads to the following invalid selector:

<a href="#" class="dropdown-item">Section 3</a>

This selector is passed to document.querySelector which says that an empty value for an anchor is not valid. Solution: choose another slugify function. Here's what we recommend to the users of Material for MkDocs:

markdown_extensions:
  - toc:
      slugify: !!python/object/apply:pymdownx.slugs.slugify
        kwds:
          case: lower

Note that this requires to pip install pymdown-extensions. Sorry for linking to our documentation, MkDocs own documentation does not seem to have a section (yet?) on configuring slugification for non-Latin languages correctly.

from mkdocs.

squidfunk avatar squidfunk commented on June 12, 2024

@tomchristie do you have any plans when the fix will be released, e.g., as part of bugfix release like 1.6.1? The reported issue is hitting all users that use the default mkdocs theme and have at least one 3rd level section.

from mkdocs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.