An MkDocs plugin that simplifies configuring page titles and their order through .pages configuration files
56
Evaluation — 56%
↓ 0.94xAgent success when using this tile
Pattern matching system for "..." rest entries in navigation configurations. Rest entries provide powerful filtering and inclusion capabilities, supporting glob patterns, regular expressions, and structural flattening options for flexible navigation control.
Core classes that handle rest entry parsing, pattern matching, and filtering logic.
class MetaNavRestItem(MetaNavItem):
"""
Handles "..." rest entries with patterns and filters.
Rest entries allow including remaining files/directories with optional
filtering using glob patterns or regular expressions.
Attributes:
type (RestType): Type of pattern matching (GLOB, REGEX, ALL)
pattern (str): Pattern string for filtering
flat (bool): Whether to flatten nested structure
Args:
value (str): Rest entry string with optional pattern/flags
"""
def __init__(self, value: str): ...
def matches(self, path: str) -> bool:
"""
Check if a file path matches this rest item's pattern.
Args:
path (str, optional): File path to test against pattern
Returns:
bool: True if path matches the pattern criteria
"""
@staticmethod
def is_rest(item: Any) -> bool:
"""
Check if an item represents a rest entry.
Args:
item (Any): Item to test
Returns:
bool: True if item is a rest entry string
"""
class RestType(Enum):
"""
Types of rest pattern matching.
Values:
GLOB: Glob pattern matching with wildcards
REGEX: Regular expression pattern matching
ALL: Include all remaining items (no filtering)
"""
GLOB = "glob"
REGEX = "regex"
ALL = "all"Container class for managing multiple rest entries with different pattern types and processing order.
class RestItemList:
"""
Container for rest items with pattern and all categories.
Separates pattern-based rest items from catch-all rest items
and provides ordered iteration for processing.
"""
def __init__(self): ...
def append(self, item: MetaNavRestItem):
"""
Add a rest item to the collection.
Args:
item (MetaNavRestItem): Rest item to add
"""
def __iter__(self) -> Iterator[MetaNavRestItem]:
"""
Iterate over rest items in processing order.
Pattern items are processed first, then catch-all items.
Returns:
Iterator[MetaNavRestItem]: Rest items in processing order
"""
def __len__(self) -> int:
"""
Get total number of rest items.
Returns:
int: Total count of pattern and all rest items
"""Basic rest entry usage:
# .pages
nav:
- introduction.md
- ... # Include all remaining files here
- conclusion.mdAdvanced rest entries with patterns:
# .pages
nav:
- overview.md
# Glob pattern matching
- ... | glob=tutorial-*.md # Files like tutorial-01.md, tutorial-basic.md
- ... | glob=api/**/*.md # All markdown files in api/ subdirectories
# Regular expression matching
- ... | regex=test.*\.md # Files matching regex pattern
- ... | regex=^guide- # Files starting with "guide-"
# Flattening nested structure
- ... | flat # Flatten all remaining items
- ... | flat | glob=*.md # Flatten and filter by pattern
# Multiple rest entries
- ... | glob=beginner-*.md # Beginner tutorials first
- ... | glob=advanced-*.md # Advanced tutorials second
- ... # Everything else last
- summary.mdPattern matching examples:
# Glob patterns (using wcmatch.glob)
"..." | glob=*.md # All .md files in current directory
"..." | glob=**/*.py # All .py files recursively
"..." | glob=test-*.md # Files starting with "test-"
"..." | glob=**/index.md # All index.md files anywhere
# Regular expressions (using re.search)
"..." | regex=test.*\.md # Files matching regex
"..." | regex=^api- # Files starting with "api-"
"..." | regex=v\d+\.md$ # Files like v1.md, v2.md, etc.
# Flattening behavior
"..." | flat # Remove directory structure, include files directly
"..." | flat | glob=*.md # Flatten structure and filter by glob patternRest entry syntax patterns:
# All rest entry variations
nav:
- ... # Include all remaining (RestType.ALL)
- ... | flat # Include all, flatten structure
- ... | glob=pattern # Filter with glob pattern (RestType.GLOB)
- ... | regex=pattern # Filter with regex (RestType.REGEX)
- ... | flat | glob=pattern # Flatten and filter with glob
- ... | flat | regex=pattern # Flatten and filter with regexUses the wcmatch library with GLOBSTAR flag support:
* matches any characters except path separators** matches any characters including path separators (recursive)? matches any single character except path separators[...] matches any character in brackets{a,b} matches either a or b (brace expansion)Uses Python's re.search() with PurePath.as_posix() normalized paths:
(?i) flag for case-insensitive)The flat flag affects how nested directory structures are handled:
Rest entries are processed in a specific order to ensure predictable results:
This ordering allows for sophisticated filtering pipelines where specific patterns capture targeted files before general catch-all entries process the remainder.
Install with Tessl CLI
npx tessl i tessl/pypi-mkdocs-awesome-pages-pluginevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10