8000 Tags · syn54x/mkdocs-typer2 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Tags: syn54x/mkdocs-typer2

Tags

v0.1.5

Toggle v0.1.5's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
fix(pretty): Fix bug where commands and options were displayed in the… (

#17)

## Pull Request: Add Support for Parsing and Rendering Command Tables in
Markdown CLI Docs

### Summary

This PR enhances the `pretty.py` module to support parsing and rendering
a **Commands** section in CLI documentation. The changes allow the
system to recognize, store, and output tables of subcommands (with names
and descriptions) in both the markdown-to-tree and tree-to-markdown
conversions.

### Details

- **New Model:**  
- Added a `CommandEntry` Pydantic model to represent individual commands
with `name` and `description` fields.
- Updated the `CommandNode` model to include a `commands:
List[CommandEntry]` field.

- **Markdown Parsing (`parse_markdown_to_tree`):**
  - Recognizes the `**Commands**:` section in markdown.
- Parses each command entry (name and description) and adds it to the
`commands` list of the current command node.
- Handles both the standard `* `name`: description` and fallback `*
`name`` formats.

- **Markdown Rendering (`tree_to_markdown`):**
- Adds a "Commands" table to the generated markdown if any commands are
present.
  - Formats the table with columns for "Name" and "Description".

- **Other Improvements:**
- Ensures section state is correctly managed when switching between
arguments, options, and commands.
  - Adds tests for edge cases in command parsing and rendering.

### Motivation

This change makes the CLI documentation more comprehensive by including
a structured list of subcommands, improving both the parsing of existing
markdown and the generation of new documentation.

### Example

A markdown section like:

```markdown
**Commands**:
* `serve`: Start the server
* `build`: Build the project
```


Will now be parsed into the tree and rendered back as a markdown table.

---

**Closes:** #16

v0.1.4

Toggle v0.1.4's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Docs/update readme (#13)

## Overview
This PR adds support for configuring the `pretty` option at the
individual documentation block level, allowing users to override the
global setting on a case-by-case basis. It also includes updates to the
project version (0.1.4) and comprehensive documentation of changes in
the CHANGELOG.

## Changes
- Added version 0.1.4 to the CHANGELOG with detailed entries
- Enhanced the `TyperProcessor.run()` method to support per-block
configuration for the `pretty` option
- Improved boolean parsing for the pretty option to properly handle
string values like "true", "false", "1", "0", etc.
- Added comprehensive tests with parameterized test cases to verify all
combinations of global and block-level settings
- Updated documentation to reflect new capabilities

## Implementation Details
The implementation properly prioritizes block-level settings over global
settings:
- The global setting is used as the default
- If a block includes a `:pretty:` directive, it overrides the global
setting
- The block-level setting properly handles different boolean-like string
values

## Testing
- Added a new parameterized test case
`test_typer_processor_pretty_option` to verify all combinations of
global and block-level pretty settings
- All 26 tests are now passing with 97% coverage
- Manually verified the functionality by running the MkDocs server and
checking the documentation output

## Other Notes
The changes are backward compatible with existing documentation and do
not affect previous functionality. Users can continue using the global
setting or now opt to override it in specific documentation blocks as
needed.

v0.1.3

Toggle v0.1.3's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Update changelog (#12)

v0.1.2

Toggle v0.1.2's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Add pydantic as dep (#10)

* Add pydantic as dependency
* bump version

v0.1.1

Toggle v0.1.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Feature/guide (#7)

* update readme
* add changelog
* change color

v0.1.0

Toggle v0.1.0's commit message
update readme

0