Skip to content

Commit ea384bf

Browse files
committed
Merge branch 'readme-concise-docs'
2 parents dfb613f + 372d7be commit ea384bf

File tree

8 files changed

+913
-21
lines changed

8 files changed

+913
-21
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
**[Full documentation →](https://ewels.github.io/nf-docs)**
1313

14-
Choose from 3 different output formats:
14+
Choose from 4 different output formats:
1515

1616
</div>
1717

@@ -23,7 +23,7 @@ Choose from 3 different output formats:
2323
</td>
2424
<td width="33%">
2525
<h3 align="center">Markdown</h3>
26-
<ul><li>Multiple files by section</li><li>Perfect for static site generators</li></ul><hr>
26+
<ul><li>Multiple files or tables by section</li><li>Perfect for static site generators</li></ul><hr>
2727
</td>
2828
<td width="33%">
2929
<h3 align="center">JSON / YAML</h3>

docs/examples.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
Generated documentation for real-world Nextflow pipelines.
44

5-
| Pipeline | Description | HTML | Markdown | JSON |
6-
| --------------- | -------------------------------------------- | ------------------------------------------- | ------------------------------------------------------ | ------------------------------------------------------- |
7-
| hello | Nextflow hello-world pipeline | [HTML](examples/hello/index.html) | [Markdown](examples/hello/markdown/index.md) | [JSON](examples/hello/json/pipeline-api.json) |
8-
| rnaseq-nf | Simple RNA-seq pipeline | [HTML](examples/rnaseq-nf/index.html) | [Markdown](examples/rnaseq-nf/markdown/index.md) | [JSON](examples/rnaseq-nf/json/pipeline-api.json) |
9-
| rnavar | nf-core/rnavar — RNA variant calling | [HTML](examples/rnavar/index.html) | [Markdown](examples/rnavar/markdown/index.md) | [JSON](examples/rnavar/json/pipeline-api.json) |
10-
| sarek | nf-core/sarek — variant calling & annotation | [HTML](examples/sarek/index.html) | [Markdown](examples/sarek/markdown/index.md) | [JSON](examples/sarek/json/pipeline-api.json) |
11-
| wf-metagenomics | Oxford Nanopore metagenomics workflow | [HTML](examples/wf-metagenomics/index.html) | [Markdown](examples/wf-metagenomics/markdown/index.md) | [JSON](examples/wf-metagenomics/json/pipeline-api.json) |
5+
| Pipeline | Description | HTML | Markdown | Table | JSON |
6+
| --------------- | -------------------------------------------- | ------------------------------------------- | ------------------------------------------------------ | ------------------------------------------------- | ------------------------------------------------------- |
7+
| hello | Nextflow hello-world pipeline | [HTML](examples/hello/index.html) | [Markdown](examples/hello/markdown/index.md) | [Table](examples/hello/table/README.md) | [JSON](examples/hello/json/pipeline-api.json) |
8+
| rnaseq-nf | Simple RNA-seq pipeline | [HTML](examples/rnaseq-nf/index.html) | [Markdown](examples/rnaseq-nf/markdown/index.md) | [Table](examples/rnaseq-nf/table/README.md) | [JSON](examples/rnaseq-nf/json/pipeline-api.json) |
9+
| rnavar | nf-core/rnavar — RNA variant calling | [HTML](examples/rnavar/index.html) | [Markdown](examples/rnavar/markdown/index.md) | [Table](examples/rnavar/table/README.md) | [JSON](examples/rnavar/json/pipeline-api.json) |
10+
| sarek | nf-core/sarek — variant calling & annotation | [HTML](examples/sarek/index.html) | [Markdown](examples/sarek/markdown/index.md) | [Table](examples/sarek/table/README.md) | [JSON](examples/sarek/json/pipeline-api.json) |
11+
| wf-metagenomics | Oxford Nanopore metagenomics workflow | [HTML](examples/wf-metagenomics/index.html) | [Markdown](examples/wf-metagenomics/markdown/index.md) | [Table](examples/wf-metagenomics/table/README.md) | [JSON](examples/wf-metagenomics/json/pipeline-api.json) |

docs/index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ Python or Javadoc for Java.
3030

3131
One file per section — integrates with static site generators like Astro, MkDocs, Zensical and Docusaurus.
3232

33+
34+
- :material-table:{ .lg .middle } __Table__
35+
36+
---
37+
38+
Compact terraform-docs-style Markdown tables with marker injection and selective section rendering.
39+
3340
- :material-code-json:{ .lg .middle } __JSON__
3441

3542
---

docs/running.md

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
nf-docs generate PIPELINE_PATH [OPTIONS]
77
```
88

9-
| Option | Description |
10-
| ------------------- | ----------------------------------------------------------- |
11-
| `--format`, `-f` | Output format: `html` (default), `markdown`, `json`, `yaml` |
12-
| `--output`, `-o` | Output file or directory (default: `docs/`) |
13-
| `--title`, `-t` | Custom title |
14-
| `--no-cache` | Force fresh extraction |
15-
| `--verbose`, `-v` | Debug output |
16-
| `--language-server` | Path to Language Server JAR |
9+
| Option | Description |
10+
| ------------------- | -------------------------------------------------------------------- |
11+
| `--format`, `-f` | Output format: `html` (default), `markdown`, `table`, `json`, `yaml` |
12+
| `--output`, `-o` | Output file or directory (default: `docs/`) |
13+
| `--title`, `-t` | Custom title |
14+
| `--no-cache` | Force fresh extraction |
15+
| `--verbose`, `-v` | Debug output |
16+
| `--language-server` | Path to Language Server JAR |
1717

1818
```bash
1919
# HTML — single shareable file
@@ -24,6 +24,10 @@ nf-docs generate . -f markdown -o docs/
2424

2525
# JSON — pipe to file or other tools
2626
nf-docs generate . -f json > api.json
27+
28+
# Table — compact terraform-docs-style tables
29+
nf-docs generate . -f table -o docs/
30+
2731
```
2832

2933
### Other commands
@@ -82,3 +86,43 @@ docs/
8286
### JSON / YAML
8387

8488
Structured data for programmatic use, CI/CD pipelines, or custom tooling.
89+
90+
### Table
91+
92+
A single `README.md` with compact Markdown tables — inspired by
93+
[terraform-docs](https://github.com/terraform-docs/terraform-docs).
94+
95+
Supports **marker-based injection** into existing README files:
96+
97+
```markdown
98+
# My Pipeline
99+
100+
Some intro text.
101+
102+
<!-- BEGIN_NF_DOCS -->
103+
<!-- END_NF_DOCS -->
104+
105+
Other content below.
106+
```
107+
108+
Running `nf-docs generate . -f table -o .` will inject the generated tables between the markers,
109+
leaving the rest of the file untouched.
110+
111+
#### Selective sections with template tags
112+
113+
Control which sections appear by adding `{{ section }}` placeholders between the markers:
114+
115+
```markdown
116+
<!-- BEGIN_NF_DOCS -->
117+
118+
{{ inputs }}
119+
120+
{{ config }}
121+
122+
<!-- END_NF_DOCS -->
123+
```
124+
125+
Available tags: `{{ header }}`, `{{ inputs }}`, `{{ config }}`, `{{ workflows }}`,
126+
`{{ processes }}`, `{{ functions }}`.
127+
128+
If no tags are present, all sections are rendered (the default).

src/nf_docs/cli.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ def main() -> None:
161161
"--format",
162162
"-f",
163163
"output_format",
164-
type=click.Choice(["json", "yaml", "markdown", "md", "html"], case_sensitive=False),
164+
type=click.Choice(["json", "yaml", "markdown", "md", "html", "table"], case_sensitive=False),
165165
default="html",
166-
help="Output format: json, yaml, markdown (or md), html (default: html)",
166+
help="Output format: json, yaml, markdown (or md), html, table (default: html)",
167167
)
168168
@click.option(
169169
"--output",
@@ -268,7 +268,7 @@ def generate(
268268
# Determine output
269269
if output_path:
270270
# Write to file/directory
271-
if output_format in ("markdown", "html"):
271+
if output_format in ("markdown", "html", "table"):
272272
created_files = renderer.render_to_directory(pipeline, output_path)
273273
progress.update(task, description="Rendering complete")
274274
else:
@@ -294,7 +294,7 @@ def generate(
294294

295295
# Output results after progress display is gone
296296
if output_path:
297-
if output_format in ("markdown", "html"):
297+
if output_format in ("markdown", "html", "table"):
298298
file_word = "file" if len(created_files) == 1 else "files"
299299
console.print(
300300
f"[green]Created {len(created_files)} {file_word} in {output_path}[/green]"

src/nf_docs/renderers/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,19 @@
66
- YAML: Structured data, human-friendly
77
- Markdown: Documentation files
88
- HTML: Self-contained static site
9+
Table: Compact Markdown tables (terraform-docs style)
910
"""
1011

1112
from nf_docs.renderers.base import BaseRenderer
1213
from nf_docs.renderers.html import HTMLRenderer
1314
from nf_docs.renderers.json import JSONRenderer
1415
from nf_docs.renderers.markdown import MarkdownRenderer
16+
from nf_docs.renderers.table import TableRenderer
1517
from nf_docs.renderers.yaml import YAMLRenderer
1618

1719
__all__ = [
1820
"BaseRenderer",
21+
"TableRenderer",
1922
"JSONRenderer",
2023
"YAMLRenderer",
2124
"MarkdownRenderer",
@@ -43,6 +46,7 @@ def get_renderer(format: str) -> type[BaseRenderer]:
4346
"markdown": MarkdownRenderer,
4447
"md": MarkdownRenderer,
4548
"html": HTMLRenderer,
49+
"table": TableRenderer,
4650
}
4751

4852
format_lower = format.lower()

0 commit comments

Comments
 (0)