A Nuxt.js renderer for pydoc-markdown that generates documentation compatible with Nuxt Content and MDC
Project description
pydoc-markdown-nuxt
A pydoc-markdown renderer for generating documentation compatible with Nuxt Content and MDC (Markdown Components).
Overview
pydoc-markdown-nuxt extends pydoc-markdown with a renderer that generates Markdown files following the Nuxt Content structure and conventions. This allows you to seamlessly integrate Python API documentation into Nuxt.js websites.
Features
- Nuxt Content Compatible: Generates Markdown files with YAML frontmatter that work with Nuxt Content's file-based routing
- Flexible Directory Structure: Configure custom directory structures and file organization
- YAML Frontmatter: Full control over page metadata through configurable frontmatter
- MDC Support: Ready for MDC (Markdown Components) syntax extensions
- Clean Integration: Works with existing pydoc-markdown configurations and processors
Installation
pip install pydoc-markdown-nuxt
Quick Start
Create a pydoc-markdown.yml configuration file:
loaders:
- type: python
search_path: [src]
processors:
- type: filter
expression: not name.startswith('_')
- type: smart
- type: crossref
renderer:
type: nuxt
content_dir: docs/content
output_dir: 3.references
Then run:
pydoc-markdown
This will generate Nuxt Content compatible Markdown files in the docs/content/3.references directory with a hierarchical structure based on your Python modules.
Configuration
Basic Options
content_dir: Directory where content files are generated (default:content)output_dir: Subdirectory within content_dir where the rendered files will be placed (default:references)
The renderer uses the NuxtMarkdownRenderer internally which provides additional customization options:
insert_header_anchors: Whether to insert anchors in headers (default:false)escape_html_in_docstring: Whether to escape HTML in docstrings (default:true)object_icons: Dictionary mapping object types to icon classesmodule_frontmatter_template: Jinja2 template for module frontmattermember_header_template: Jinja2 template for member headers
Directory Structure
The renderer generates a hierarchical directory structure based on your Python modules:
content/
└── {output_dir}/
└── {module_name}/
├── .navigation.yml
├── index.md
└── {submodules}/
Example Configuration
loaders:
- type: python
search_path: [src]
processors:
- type: filter
expression: not name.startswith('_')
- type: filter
expression: not name.startswith('test_')
- type: smart
- type: crossref
renderer:
type: nuxt
content_dir: docs/content
output_dir: 3.references
Generated Output
The renderer generates Markdown files with YAML frontmatter following Nuxt Content structure:
Module Files (index.md)
---
title: 'module_name'
description: 'Module description from docstring'
navigation:
title: 'module_name'
icon: 'i-codicon-library'
---
# Module Documentation
Module docstring content here...
Class/Function Files (with MDC components)
## MyClass
::reference-header
---
description: >
A sample class for demonstration.
lang: 'python'
type: 'class'
navigation:
title: 'MyClass'
icon: 'i-codicon-symbol-class'
level: 1
---
::
Class docstring content...
### my_method
::reference-header
---
description: >
A sample method that does something useful.
lang: 'python'
type: 'method'
navigation:
title: 'my_method'
icon: 'i-codicon-symbol-method-arrow'
level: 2
---
::
Method docstring content...
Navigation Files (.navigation.yml)
title: "module_name"
icon: "i-codicon-library"
Integration with Nuxt Content
The generated files work seamlessly with Nuxt Content:
- File-based Routing: Files in
content/automatically become pages - Hierarchical Navigation: Automatic navigation based on directory structure
- Navigation Files:
.navigation.ymlfiles control sidebar appearance - MDC Components: Uses
::reference-headercomponent for rich documentation display - Icon Support: Integrated with Iconify for consistent iconography
MDC Components
The renderer uses custom MDC components for enhanced documentation:
::reference-header
---
description: >
Method or class description
lang: 'python'
type: 'method'
typing: 'str' # Optional type annotation
navigation:
title: 'method_name'
icon: 'i-codicon-symbol-method'
level: 2
---
::
This allows for rich, interactive documentation with consistent styling across your API reference.
Development
To contribute to this project:
git clone https://github.com/UrielCuriel/pydoc-markdown-nuxt
cd pydoc-markdown-nuxt
pip install -e .
Run tests:
pytest
Generate documentation for testing:
pydoc-markdown
License
MIT License - see LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydoc_markdown_nuxt-0.2.1.tar.gz.
File metadata
- Download URL: pydoc_markdown_nuxt-0.2.1.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f53875a38da922d52465cf1bbb78618553f441d61c3dda154b9fb63d4ae49089
|
|
| MD5 |
365c420153d86f5c0749242e21ec0be8
|
|
| BLAKE2b-256 |
4e42c086339c1cc827b60595ecf34d774122393899efe625fc5b4142676356ed
|
File details
Details for the file pydoc_markdown_nuxt-0.2.1-py3-none-any.whl.
File metadata
- Download URL: pydoc_markdown_nuxt-0.2.1-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
547914e1105bd3787921abca55c6be1719c2918ce85667ca10f26c5199034674
|
|
| MD5 |
095af30e45f3d8a3e142373dbf2d1071
|
|
| BLAKE2b-256 |
80a2fe65cbe0aec6dd63904d7eadce70f7c22c126630c4b9707b94f3615b4971
|