Skip to content

Improve debug output for subclasses of navigation elements#3340

Merged
squidfunk merged 1 commit intomasterfrom
feature/page-subclassing
Aug 18, 2023
Merged

Improve debug output for subclasses of navigation elements#3340
squidfunk merged 1 commit intomasterfrom
feature/page-subclassing

Conversation

@squidfunk
Copy link
Contributor

I'm currently rewriting the blog plugin in Material for MkDocs (which is now free as part of the community edition), trying to improve interop with the plugin ecosystem, specifically plugins like awesome-pages or static-i18n. For this, I'm subclassing some of the existing classes. However, when we print nav for debugging, the names of the subclasses are not taken into account. This PR improves debug output when subclassing Page, Link or Section classes, which is especially useful for understanding navigation structure.

In this example, Archive and Category are subclasses of Page:

Section(title='Blog')
    Page(title=[blank], url='/blog/')
    Page(title=[blank], url='/blog/about/')
    Section(title='Archive')
        Archive(title='2023', url='/blog/archive/2023/')
        Archive(title='2022', url='/blog/archive/2022/')
    Section(title='Categories')
        Category(title='foo', url='/blog/category/foo/')
        Category(title='bar', url='/blog/category/bar/')

@squidfunk squidfunk requested a review from oprypin August 17, 2023 10:02
Copy link
Contributor

@oprypin oprypin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@squidfunk squidfunk merged commit c8bd1af into master Aug 18, 2023
@squidfunk squidfunk deleted the feature/page-subclassing branch August 18, 2023 13:37
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.

2 participants