Skip to content

topmark.presentation.markdown.version

topmark / presentation / markdown / version

Markdown renderers for the topmark version command.

These helpers return Markdown strings and perform no I/O.

Notes

Machine-readable formats (JSON/NDJSON) are handled via the version machine serializers and the generic CLI machine emitter.

render_version_markdown

render_version_markdown(report)

Render topmark version output as Markdown.

Markdown output is document-oriented and intentionally ignores TEXT-only verbosity and quiet controls.

Parameters:

Name Type Description Default
report VersionHumanReport

The human version information report.

required

Returns:

Type Description
str

A Markdown document as a single string.

Source code in src/topmark/presentation/markdown/version.py
def render_version_markdown(
    report: VersionHumanReport,
) -> str:
    """Render `topmark version` output as Markdown.

    Markdown output is document-oriented and intentionally ignores TEXT-only
    verbosity and quiet controls.

    Args:
        report: The human version information report.

    Returns:
        A Markdown document as a single string.
    """
    lines: list[str] = [
        "# TopMark Version",
        "",
        f"**Version format:** `{report.version_format}`",
        f"**Version:** `{report.version_text}`",
    ]

    if report.error is not None:
        lines.extend(["", f"> **Warning:** {report.error}"])

    lines.append("")
    return "\n".join(lines)
render_version_footer_markdown()

Render a standardized 'Generated with TopMark footer.

Source code in src/topmark/presentation/markdown/version.py
def render_version_footer_markdown() -> str:
    """Render a standardized 'Generated with TopMark <version> footer."""
    return "\n".join(
        [
            "---",
            f"_Generated with TopMark v{TOPMARK_VERSION}_",
        ]
    )