1515
1616StreamingContentType = Literal [
1717 "markdown" ,
18- "semi-markdown" ,
1918 "html" ,
19+ "semi-markdown" ,
2020 "text" ,
2121]
2222
@@ -42,9 +42,13 @@ class MarkdownStream:
4242 id
4343 A unique identifier for this markdown stream.
4444 content
45- Initial (starting) content.
45+ Some content to display before any streaming occurs .
4646 content_type
47- The content type of the markdown content. Default is "markdown".
47+ The content type. Default is "markdown" (specifically, CommonMark).
48+ Other supported options are:
49+ - `"html"`: for rendering HTML content.
50+ - `"text"`: for plain text.
51+ - `"semi-markdown"`: for rendering markdown, but with HTML tags escaped.
4852
4953 Note
5054 ----
@@ -88,6 +92,9 @@ def stream(self, content: Iterable[str], clear: bool = True):
8892
8993 Parameters
9094 ----------
95+ content
96+ The content to stream. This can be any iterable of strings, such as a list,
97+ generator, or file-like object.
9198 clear
9299 Whether to clear the existing content before streaming the new content.
93100 """
@@ -145,6 +152,7 @@ def _send_custom_message(self, msg: ContentMessage | isStreamingMessage):
145152 )
146153
147154
155+ @add_example ()
148156def output_markdown_stream (
149157 id : str ,
150158 content : str = "" ,
@@ -161,9 +169,13 @@ def output_markdown_stream(
161169 id
162170 A unique identifier for this markdown stream.
163171 content
164- Initial (starting) content.
172+ Some content to display before any streaming occurs .
165173 content_type
166- The content type of the markdown content. Default is "markdown".
174+ The content type. Default is "markdown" (specifically, CommonMark).
175+ Other supported options are:
176+ - `"html"`: for rendering HTML content.
177+ - `"text"`: for plain text.
178+ - `"semi-markdown"`: for rendering markdown, but with HTML tags escaped.
167179 """
168180 return Tag (
169181 "shiny-markdown-stream" ,
0 commit comments