Skip to content

Commit 533562c

Browse files
committed
refactor: use newer py-shinylive syntax
1 parent 57b7082 commit 533562c

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

shiny/_docstring.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -181,25 +181,11 @@ def _(func: F) -> F:
181181
except ModuleNotFoundError:
182182
raise RuntimeError("Please install shinylive to build the docs.")
183183

184-
SHINYLIVE_CODE_TEMPLATE = """
185-
```{{shinylive-python}}
186-
#| standalone: true
187-
#| components: [editor, viewer]
188-
#| layout: vertical
189-
#| viewerHeight: 400
190-
191-
{0}
192-
```
193-
"""
194-
195184
class ShinyliveExampleWriter(ExampleWriter):
196185
def write_example(self, app_files: list[str]) -> str:
197186
app_file = app_files.pop(0)
198-
bundle = shinylive._url.create_shinylive_bundle_file(
199-
app_file, app_files, language="py"
200-
)
201-
code = shinylive._url.create_shinylive_chunk_contents(bundle)
187+
app = shinylive.url_encode(app_file, app_files, language="py")
202188

203-
return SHINYLIVE_CODE_TEMPLATE.format(code.strip())
189+
return app.chunk(layout="vertical", viewerHeight=400)
204190

205191
example_writer = ShinyliveExampleWriter()

0 commit comments

Comments
 (0)