Skip to content

fix(cli/docs): emit markdown-safe CLI reference (fenced examples, inline aliases)#1269

Open
ppiegaze wants to merge 1 commit into
mainfrom
docsy/cli-doc-gen-markdown-safe
Open

fix(cli/docs): emit markdown-safe CLI reference (fenced examples, inline aliases)#1269
ppiegaze wants to merge 1 commit into
mainfrom
docsy/cli-doc-gen-markdown-safe

Conversation

@ppiegaze

Copy link
Copy Markdown
Member

Problem

flyte gen docs --type markdown produces the CLI reference page (flyte-cli.md) for the docs site. For plugin commands it wraps each command in a {{< variant >}}{{< markdown >}} block (variant-gating). Two constructs it emits then break the Hugo build inside that block:

  1. Multi-name/alias options are rendered with the {{< multiline >}} shortcode (_gen.py), which outputs raw <div>/<br/> HTML. Inside {{< markdown >}}'s .Page.RenderString (goldmark unsafe=false, build run with --panicOnWarning) that is a fatal "Raw HTML omitted".
  2. Examples: blocks come through as indentation-based code, which doesn't survive RenderString and renders inconsistently.

Core commands sit in plain page markdown (shortcode HTML passes straight through, never re-rendered), so this only bites plugin commands — and only surfaced now because flyte 2.5.6's new flyte connect plugin command is the first with multi-alias options + an Examples block. It took down the entire Build and deploy docs job (see unionai-docs#1153).

Fix (src/flyte/cli/_gen.py)

  • Aliases inline: render multi-name options as `--a` `--b` instead of the {{< multiline >}} shortcode — works in both plain and {{< markdown >}} contexts, no raw HTML.
  • Fenced examples: new _format_command_help() formats command help with inspect.cleandoc (handles the first-line-on-""" docstring case that textwrap.dedent can't) and wraps indented blocks in fenced ```bash code blocks instead of relying on indentation.

Docs-pipeline plumbing only; no runtime/behavior change. Verified the formatter output on the connect ssh help (prose dedented, examples fenced, <…> placeholders now safe inside the fence).

🤖 Generated with Claude Code

ppiegaze added a commit to unionai/unionai-docs that referenced this pull request Jun 29, 2026
…s + inline aliases)

Replaces the hand-patched stopgap with a full regeneration using the fixed CLI
doc generator (flyteorg/flyte-sdk#1269): all multi-name options render inline
(no {{< multiline >}} raw HTML) and all command Examples are fenced ```bash
blocks (no indentation-based code). Version pinned to 2.5.6 (the local SDK build
reports a dev version). Durable once #1269 ships; until then the committed file
is the correct shape.
ppiegaze added a commit to unionai/unionai-docs that referenced this pull request Jun 29, 2026
…#1153)

* docsy(v2): regenerate API reference 2.5.2 → 2.5.6 (maintenance regen)

Regenerated flyte SDK + flyte-cli + plugin API reference from the 2.5.6
docstrings via 'make update-api-docs'. All 24 packages were stale at 2.5.2.
No condition-API surface change between 2.5.2 and 2.5.6.

* test(regen): drop angle brackets from connect-ssh example <name> to test Hugo raw-HTML build failure

* fix(regen): fence indented CLI example blocks in flyte-cli.md

The 2.5.6 'flyte connect'/'create api-key' help text emitted Examples as
4-space-indented blocks; inside {{< markdown >}} RenderString these render as
prose, so the <name>/<base64-...> placeholders became raw HTML and (under
--panicOnWarning) failed the Hugo build. Wrap the example commands in fenced
```bash blocks (dedented) so they render as code and the angle brackets are safe.

* fix(regen): replace multiline shortcode with inline flags in plugin CLI table

Root cause of the Hugo build failure: {{< multiline >}} emits <div>/<br/> raw HTML.
Inside the {{< markdown >}} RenderString path (unsafe off, --panicOnWarning) that is
a fatal 'Raw HTML omitted'. main has 0 such rows; the 2.5.6 'connect ssh' plugin
command added 2 multi-alias flag rows inside a markdown block. Render the aliases
inline as `--a` / `--b` instead (plain markdown, no raw HTML).

* regen(cli): flyte-cli.md from markdown-safe generator (fenced examples + inline aliases)

Replaces the hand-patched stopgap with a full regeneration using the fixed CLI
doc generator (flyteorg/flyte-sdk#1269): all multi-name options render inline
(no {{< multiline >}} raw HTML) and all command Examples are fenced ```bash
blocks (no indentation-based code). Version pinned to 2.5.6 (the local SDK build
reports a dev version). Durable once #1269 ships; until then the committed file
is the correct shape.
@ppiegaze ppiegaze marked this pull request as ready for review June 29, 2026 16:33
…ine aliases)

The 'flyte gen docs' markdown output broke the Hugo docs build when a *plugin*
command (rendered inside a {{< markdown >}} variant block) had:
  1) a multi-name/alias option — emitted via the {{< multiline >}} shortcode,
     which produces raw <div>/<br/> HTML. Inside {{< markdown >}}.RenderString
     (goldmark unsafe=false + --panicOnWarning) that is a fatal 'Raw HTML omitted'.
  2) an 'Examples:' block — emitted as indentation-based code, which doesn't
     survive RenderString and renders inconsistently.

Fixes:
  - Render option aliases inline (`--a` `--b`) instead of {{< multiline >}}.
  - Format command help via inspect.cleandoc (handles the first-line-on-quotes
    docstring case) and wrap indented blocks in fenced ```bash code blocks.

Surfaced regenerating the v2 API reference for flyte 2.5.6 (new 'flyte connect'
plugin command); see unionai-docs#1153.

Signed-off-by: ppiegaze <1153481+ppiegaze@users.noreply.github.com>
@ppiegaze ppiegaze force-pushed the docsy/cli-doc-gen-markdown-safe branch from be6c030 to 04f6e56 Compare June 29, 2026 16:37
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