Skip to content

Commit 3413029

Browse files
committed
Tweak example code
1 parent 9d459ce commit 3413029

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

shiny/api-examples/MarkdownStream/app-express.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77

88
ui.page_opts(full_width=True)
99

10+
# Initialize a markdown stream object
11+
md = ui.MarkdownStream("shiny-readme")
12+
13+
# Display the stream UI in a card
14+
with ui.card(height="400px", class_="mt-3", full_screen=True):
15+
ui.card_header("Shiny README.md")
16+
md.ui()
17+
18+
1019
# Read in the README.md file from the py-shiny repository
1120
readme = requests.get(
1221
"https://raw.githubusercontent.com/posit-dev/py-shiny/refs/heads/main/README.md"
@@ -22,15 +31,6 @@ async def chunk_generator():
2231
yield chunk + " "
2332

2433

25-
md = ui.MarkdownStream("shiny-readme")
26-
27-
with ui.card(height="400px", class_="mt-3", full_screen=True):
28-
ui.card_header("Shiny README.md")
29-
md.ui()
30-
31-
md.ui(height=300)
32-
33-
3434
@reactive.effect
3535
async def _():
3636
await md.stream(chunk_generator())

0 commit comments

Comments
 (0)