question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tags plugin: Empty tags aren't handled properly

See original GitHub issue

Contribution guidelines

I’ve found a bug and checked that …

  • … the problem doesn’t occur with the mkdocs or readthedocs themes
  • … the problem persists when all overrides are removed, i.e. custom_dir, extra_javascript and extra_css
  • … the documentation does not mention anything about my problem
  • … there are no open or closed issues that are related to my problem

Description

When adding an empty tag, the tags plugin throws an unhandled exception.

mkdocs.yml:

site_name: Test Project
theme:
    name: material
use_directory_urls: false
nav:
  - Welcome: index.md
plugins:
  - search
  - tags:
      tags_file: index.md

sample.md:

---
tags:
  - My tag
  - 
---

# Topic 1

Lorem ipsum

Build result:

  File "/opt/homebrew/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mkdocs/__main__.py", line 250, in build_command
    build.build(cfg, dirty=not clean)
  File "/opt/homebrew/lib/python3.11/site-packages/mkdocs/commands/build.py", line 308, in build
    _populate_page(file.page, config, files, dirty)
  File "/opt/homebrew/lib/python3.11/site-packages/mkdocs/commands/build.py", line 177, in _populate_page
    page.markdown = config.plugins.run_event(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mkdocs/plugins.py", line 520, in run_event
    result = method(item, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/material/plugins/tags/plugin.py", line 100, in on_page_markdown
    return self._render_tag_index(markdown, page)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/material/plugins/tags/plugin.py", line 171, in _render_tag_index
    for name in sorted(
                ^^^^^^^
TypeError: '<' not supported between instances of 'NoneType' and 'str'

Expected behaviour

Missing tags should be handled properly, ideally with a proper error message.

Actual behaviour

See description

Steps to reproduce

See description

Package versions

  • Python: 3.11
  • MkDocs: 1.4.2
  • Material: Latest insider version

Configuration

See description

System information

  • Operating system: macOS Ventura
  • Browser: FF

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
wilhelmercommented, Nov 28, 2022

Overdelivering as usual! 🚀 Thanks!

0reactions
squidfunkcommented, Nov 28, 2022

Released as part of 8.5.10-insiders-4.26.6.

Read more comments on GitHub >

github_iconTop Results From Across the Web

DEALING WITH EMPTY TAGS IN WORDPRESS
If you are dealing with empty tags in WordPress you have come to the right place. I have a very simple solution for...
Read more >
Empty alt tags aren't displaying correctly
I think the best solution for this issue is to edit the image alt from media library or from the editor you are...
Read more >
Empty P tags. Grr. | ExpressionEngine 2 Tech Support
So, I have a standard textarea field with XHTML filtering turned on. I insert some embed code for a Vimeo video (which is...
Read more >
or "<p>&nbsp;</p>" or "<br />" added to empty textareas. [# ...
Hello, I have a node were I added CCK text area (multi row) field. It is optional and ideally if some one doesn't...
Read more >
Self-closing tags in XML files
Empty-element tags may be used for any element which has no content, whether or not it is declared using the keyword EMPTY.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found