Problem
The client accepts a content_type value that the Python API does not expose: "semi-markdown".
Client — shiny/www/py-shiny/markdown-stream/markdown-stream.js handles four values, dispatching semi-markdown to a different marked renderer than markdown:
if (e === "markdown") { ... renderer: uo ... }
else if (e === "semi-markdown") { ... renderer: po ... } // distinct renderer
else if (e === "html") { ... }
else if (e === "text") { return t; }
else throw new Error(`Unknown content type: ${e}`);
Python — shinychat/_markdown_stream.py L20:
StreamingContentType = Literal[
"markdown",
"html",
"text",
]
Nothing under shiny/ui/ mentions semi-markdown.
Consequence
Passing content_type="semi-markdown" works at runtime (Literal is not enforced) but fails type checking, and is undiscoverable from the Python side. The po renderer appears to be the HTML-escaping variant, which is a genuinely useful mode for streaming untrusted LLM output — so this is a real capability that is currently reachable only by accident.
Suggested resolution
Pick one:
- Expose it — add
"semi-markdown" to StreamingContentType and document what it does differently from "markdown" (escaping behavior). Preferred if the escaping mode is intentional.
- Remove it — drop the branch from the JS if it is a vestigial port from R Shiny.
Either way the two sides should agree.
Context: the docs site briefly documented "semi-markdown" as a valid value and removed it after discovering it was absent from the Python signature (posit-dev/py-shiny-site#418). Verified against shiny 1.7.1.dev6.
Problem
The client accepts a
content_typevalue that the Python API does not expose:"semi-markdown".Client —
shiny/www/py-shiny/markdown-stream/markdown-stream.jshandles four values, dispatchingsemi-markdownto a differentmarkedrenderer thanmarkdown:Python —
shinychat/_markdown_stream.pyL20:Nothing under
shiny/ui/mentionssemi-markdown.Consequence
Passing
content_type="semi-markdown"works at runtime (Literalis not enforced) but fails type checking, and is undiscoverable from the Python side. Theporenderer appears to be the HTML-escaping variant, which is a genuinely useful mode for streaming untrusted LLM output — so this is a real capability that is currently reachable only by accident.Suggested resolution
Pick one:
"semi-markdown"toStreamingContentTypeand document what it does differently from"markdown"(escaping behavior). Preferred if the escaping mode is intentional.Either way the two sides should agree.
Context: the docs site briefly documented
"semi-markdown"as a valid value and removed it after discovering it was absent from the Python signature (posit-dev/py-shiny-site#418). Verified againstshiny1.7.1.dev6.