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.

Best "nav" plugin but Please have Regex/Glob patterns to specify files !

See original GitHub issue

TL;DR

Best nav plugin, though it’s missing ability to specify files with Regex OR Glob pattern.


Everything is just beautiful. One thing though I noticed is it’s missing the ability to specify which files to place under a specific section using a regex or glob patterns.

So like the “…” just places anything that hasn’t been specified:

nav:
    - section
        - ...

… which is very useful ! But also what would be useful is if you could place specific files under a section based on a regular expression or glob pattern:

nav:
    - Math:
        - 'Math Notes - .+\.md'
        - 'Math Notes - *.md'
    - Physics:
        - 'Physics Notes - .+\.md'
        - 'Physics Notes - *.md'
    - Exams:
        - '**/* Exam - *.md'

Either Regex or Glob patterns, if you can do both even better. I’m not too familiar with what’s possible but just an idea: maybe to differentiate what’s a regular, regex or glob string, you could do kinda like the python format string and have: nothing/ ‘r’ / ‘g’ preprend the string respectively:

nav:
    - Math:
        - 'Math Notes - Calculus.md'
        - r'Math Notes - .+\.md'
        - g'Math Notes - *.md'

Probably just getting ahead of myself. But you get the idea. I think the mkdocs-exclude has an implementation of regex/glob patterns.

If you could make that happen that would be amazing ! And make this the most complete “nav” plugin. Thanks in advance. Very grateful for your plugin. 🎩 s off brother.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
lukasgeitercommented, Dec 22, 2020

I’ve just released version 2.5.0 with this feature. The syntax I settled on is ... | foo-*.md (or ... | glob=foo-*.md) for glob patterns and ... | regex=foo-[0-9]+.md for regex. You can find all details in the updated README.

0reactions
ojacquescommented, Mar 2, 2021

@lukasgeiter - I just wanted to send over a million thanks 🙏🙏🙏 for this feature.

This allows for example to hide specific files from the navigation:

nav:
    # Show everything except template<something> files
    - ... | regex=^(?!template).*$

I do have template.md files which I don’t want to show in navigation, but still want to generate and refer to. Perfect!

Read more comments on GitHub >

github_iconTop Results From Across the Web

The 8 Best WordPress Menu Plugins - Hostinger
Creating a beautiful, fully-functioning menu for your website is easier and way more effective with these amazing WordPress menu plugins!
Read more >
11 Best WordPress Menu Plugins to Extend ... - Kinsta
Curated list of the best WordPress menu plugins to create custom menus: resposive, mega menu, horizontal, vertical, images, maps, and many ...
Read more >
Nav menus (top and main) change in cat pages - WordPress.org
Hi, I suddenly realized that the main and top menus change in category pages. ... The menu is the same in all pages,...
Read more >
How to Add Custom Navigation Menus in WordPress Themes
Do you want to add custom navigation menus in your WordPress theme? All themes have set locations where you can display a navigation...
Read more >
15 Best WordPress Menu Plugins (Most Are FREE) 2022
Having a great WordPress navigation plugin makes everything a lot easier. But what to look for in a menu plugin when picking one?...
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