Skip to content

Add table renderer with terraform-docs-style output and marker injection#1

Merged
ewels merged 6 commits intoewels:mainfrom
adamrtalbot:readme-concise-docs
Mar 3, 2026
Merged

Add table renderer with terraform-docs-style output and marker injection#1
ewels merged 6 commits intoewels:mainfrom
adamrtalbot:readme-concise-docs

Conversation

@adamrtalbot
Copy link
Copy Markdown
Contributor

@adamrtalbot adamrtalbot commented Feb 23, 2026

Summary

Add a new table output format that generates compact Markdown tables, inspired by terraform-docs and related to nextflow-io/nf-schema#201.

Changes

  • New TableRenderer (src/nf_docs/renderers/table.py) — generates terraform-docs-style dense Markdown tables with sections for Inputs (grouped), Configuration, Workflows (with calls), Processes (with I/O sub-tables), and Functions
  • Marker-based injection — supports <!-- BEGIN_NF_DOCS --> / <!-- END_NF_DOCS --> markers for embedding generated docs into an existing README without overwriting surrounding content
  • CLI integrationnf-docs generate . -f table writes a README.md to the output directory
  • 47 renderer tests (10 for marker injection, 12 for table rendering, 25 existing unchanged)

Marker injection

When the output README.md already exists and contains the markers:

# My Pipeline

Some custom intro text.

<!-- BEGIN_NF_DOCS -->
(auto-generated content replaced here)
<!-- END_NF_DOCS -->

Custom footer text preserved.

Running nf-docs generate . -f table -o . will replace only the content between the markers, preserving everything else. If no markers exist, the file is created with markers wrapping the content.

Example output

# my-pipeline

**Version:** 1.0.0 · A pipeline for analysis

## Inputs

### Input/output

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| `--input` | Path to input | `string` | n/a | yes |
| `--outdir` | Output directory | `string` | `./results` | no |

## Processes

| Name | Description |
|------|-------------|
| `FASTQC` | Run FastQC on input reads |
| `MULTIQC` | Aggregate QC reports |

…ction

Add a new 'concise' output format that generates compact Markdown tables
inspired by terraform-docs. Includes marker-based injection support so
generated docs can be embedded in existing README files between
<!-- BEGIN_NF_DOCS --> and <!-- END_NF_DOCS --> markers.

Generated by Claude Code
Copy link
Copy Markdown
Owner

@ewels ewels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

# Inputs
if proc.meta_inputs or proc.inputs:
rows: list[str] = [
f"### `{proc.name}` Inputs",
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inputs, not params / parameters?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, ok - to match outputs below. Fair enough.

Rename ConciseRenderer -> TableRenderer and concise.py -> table.py
to better reflect the terraform-docs-inspired table output format.
CLI format option is now 'table' instead of 'concise'.

Generated by Claude Code
@adamrtalbot adamrtalbot changed the title Add concise renderer with terraform-docs-style tables and marker injection Add table renderer with terraform-docs-style output and marker injection Feb 23, 2026
Users can now place {{ section }} tags between BEGIN_NF_DOCS / END_NF_DOCS
markers to control which sections are rendered (e.g. {{ inputs }}, {{ config }}).
Empty markers render everything (backward compatible). Inspired by terraform-docs.

Generated by Claude Code
Generated by Claude Code
@adamrtalbot
Copy link
Copy Markdown
Contributor Author

adamrtalbot commented Feb 23, 2026

I've added selective items, so you can do this:

<!-- BEGIN_NF_DOCS -->
{{ inputs }}
{{ config }} 
<!-- END_NF_DOCS -->

And discard everything else. This could be useful for adding high level docs for a README.md

Generated by Claude Code
@ewels ewels merged commit 995b9ce into ewels:main Mar 3, 2026
6 of 8 checks passed
@ewels
Copy link
Copy Markdown
Owner

ewels commented Mar 3, 2026

I didn't have push permissions to your fork, so I just merged. But see main for a couple of commits I added on at the end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants