From 0bffceff133a28aea66ae29285d92f8af7f89ac4 Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Sat, 31 Jan 2026 00:58:43 +0000 Subject: [PATCH] Add templates and example files for Python, Go, and JavaScript --- doc2man/templates/markdown.j2 | 87 +++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 doc2man/templates/markdown.j2 diff --git a/doc2man/templates/markdown.j2 b/doc2man/templates/markdown.j2 new file mode 100644 index 0000000..c7cbf1d --- /dev/null +++ b/doc2man/templates/markdown.j2 @@ -0,0 +1,87 @@ +{% if title %} +# {{ title }} + +{% endif %} +{% if data %} +{% for item in data %} +{% set file_path = item.file|default('Unknown', true) %} +{% set funcs = item.data.functions|default([], true) %} +{% set classes = item.data.classes|default([], true) %} +{% set desc = item.data.description|default('', true) %} + +{% if desc %} +{{ desc }} + +{% endif %} +{% if funcs %} +## Functions + +{% for func in funcs %} +### `{{ func.name }}` + +{% if func.description %} +{{ func.description }} + +{% endif %} +{% if func.args|default([], true) %} +#### Parameters + +| Name | Type | Description | +|------|------|-------------| +{% for param in func.args %} +| `{{ param.name }}` | `{{ param.type|default('', true) }}` | {{ param.description|default('', true) }} | +{% endfor %} + +{% endif %} +{% if func.returns %} +#### Returns + +{% if func.returns.type %}`{{ func.returns.type }}` {% endif %}{{ func.returns.description|default('', true) }} + +{% endif %} +{% if func.raises|default([], true) %} +#### Raises + +{% for raise in func.raises %} +- `{{ raise.exception }}`: {{ raise.description|default('', true) }} +{% endfor %} + +{% endif %} +{% if func.examples|default([], true) %} +#### Examples + +```python +{% for example in func.examples %} +{{ example }} +{% endfor %} +``` + +{% endif %} +--- +{% endfor %} +{% endif %} +{% if classes %} +## Classes + +{% for cls in classes %} +### `{{ cls.name }}` + +{% if cls.description %} +{{ cls.description }} + +{% endif %} +{% if cls.methods|default([], true) %} +#### Methods + +{% for method in cls.methods %} +- `{{ method.name }}`: {% if method.description %}{{ method.description|first_line }}{% endif %} +{% endfor %} + +{% endif %} +--- +{% endfor %} +{% endif %} +{% endfor %} +{% else %} +No documentation found. +{% endif %}