Skip to content

Commit 0e4ceca

Browse files
committed
Use shinylive-python class for API docs
1 parent bd835bb commit 0e4ceca

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace pollution. Namely, it gives you:
2525
* If you're using type checking, you'll also want to use the ``Inputs``, ``Outputs``, and ``Session`` Classes
2626
to type the instances supplied to your server function, for example:
2727

28-
.. shinyeditor::
28+
.. shinylive-editor::
2929

3030
from shiny import *
3131

docs/sphinxext/pyshinyapp.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
:width: 100%
55
:height: 500px
66
7-
.. shinyeditor::
7+
.. shinylive-editor::
88
:width: 100%
99
:height: 500px
1010
@@ -67,14 +67,14 @@ def html(self):
6767
style = css(height=self["height"], width=self["width"])
6868
type = self["type"]
6969
code = self["code"]
70-
if type == "shinyeditor":
70+
if type == "shinylive-editor":
7171
# TODO: allow the layout to be specified (right now I don't think we need
7272
# horizontal layout, but maybe someday we will)
73-
code = "#| layout: vertical\n" + code
74-
# the class for the editor currently is, somewhat confusingly, pyshiny
75-
type = "shiny"
73+
code = "#| standalone: true\n#| layout: vertical\n" + code
7674

77-
return f'<pre class="py{type}" style="{style}"><code>{code}</code></pre>'
75+
return (
76+
f'<pre class="shinylive-python" style="{style}"><code>{code}</code></pre>'
77+
)
7878

7979

8080
def _run(self: SphinxDirective, type: str):
@@ -99,9 +99,9 @@ def run(self):
9999
return _run(self, "shinyapp")
100100

101101

102-
class ShinyEditorDirective(BaseDirective):
102+
class ShinyliveEditorDirective(BaseDirective):
103103
def run(self):
104-
return _run(self, "shinyeditor")
104+
return _run(self, "shinylive-editor")
105105

106106

107107
class CellDirective(BaseDirective):
@@ -151,7 +151,7 @@ def skip(self: Sphinx, node: Element):
151151
man=(skip, None),
152152
)
153153
app.add_directive("shinyapp", ShinyAppDirective)
154-
app.add_directive("shinyeditor", ShinyEditorDirective)
154+
app.add_directive("shinylive-editor", ShinyliveEditorDirective)
155155
app.add_directive("cell", CellDirective)
156156
app.add_directive("terminal", TerminalDirective)
157157

shiny/_docstring.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,12 @@ class DocStringWithExample(str):
2323

2424
def add_example(
2525
directive: Literal[
26-
"shinyapp::", "shinyeditor::", "code-block:: python", "cell::", "terminal::"
27-
] = "shinyeditor::",
26+
"shinyapp::",
27+
"shinylive-editor::",
28+
"code-block:: python",
29+
"cell::",
30+
"terminal::",
31+
] = "shinylive-editor::",
2832
**options: str,
2933
) -> Callable[[F], F]:
3034
"""
@@ -40,7 +44,7 @@ def add_example(
4044
A directive for rendering the example. This can be one of:
4145
- ``shinyapp``: A live shiny app (statically served via wasm).
4246
- ``code``: A python code snippet.
43-
- ``shinyeditor``: A live shiny app (statically served via wasm).
47+
- ``shinylive-editor``: A live shiny app with editor (statically served via wasm).
4448
- ``cell``: A executable Python cell.
4549
- ``terminal``: A minimal Python IDE
4650
**options

0 commit comments

Comments
 (0)