{%- set about = spec.about_long | default(value=spec.about | default(value="")) %}
{%- set cmd = spec.cmd %}
{%- set full_cmd = cmd.full_cmd | join(sep=" ") %}
{{- "#" | repeat(count=header_level) }} `{{ (spec.bin ~ " " ~ full_cmd) | trim }}`

{%- if spec.version %}
- **version**: {{ spec.version }}{% endif %}
{%- if spec.author %}
- **author**: {{ spec.author }}{% endif %}
{%- if spec.license %}
- **license**: {{ spec.license }}{% endif %}
{%- if spec.repository %}
- **repository**: {{ spec.repository }}{% endif %}

{%- if about %}

{{ about }}
{% endif %}

{%- if spec.examples %}

{{ "#" | repeat(count=header_level) }}# Examples

{%- for example in spec.examples %}
{%- if example.header %}

**{{ example.header }}**
{%- endif %}
{%- if example.help %}

{{ example.help }}
{%- endif %}

```{{ example.lang }}
{{ example.code }}
```
{%- endfor %}
{%- endif %}

{%- include "cmd_template.md.tera" %}
{%- set header_level = header_level + 1 %}

{%- for cmd in all_commands %}
{%- set full_cmd = cmd.full_cmd | join(sep=" ") %}

{{ "#" | repeat(count=header_level) }} `{{ (spec.bin ~ " " ~ full_cmd) | trim }}`

{%- include "cmd_template.md.tera" %}
{%- endfor %}
{#- Settings after the commands: a reader looking for a flag wants the command list first,
    and a CLI with no settings renders nothing at all here. #}
{#- A plain `include`, and the blank line before it kept: `{%- include %}` strips the whitespace
    in *this* template, so the section's heading was glued onto the last line of the command
    above it — `Run# Configuration`. And no decrement of `header_level`: the commands render at
    level 2, so dropping to 1 put `# Configuration` beside the document's own title. -#}
{%- if config.props or config.files %}

{% include "config_template.md.tera" %}
{%- endif -%}
