MCPcopy Index your code
hub / github.com/reactive-python/reactpy / run

Method run

docs/source/_exts/reactpy_view.py:26–57  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

24 }
25
26 def run(self):
27 IteractiveWidget._next_id += 1
28 container_id = f"reactpy-widget-{IteractiveWidget._next_id}"
29 view_id = get_normalized_example_name(
30 self.arguments[0],
31 # only used if example name starts with "/"
32 self.get_source_info()[0],
33 )
34 return [
35 raw(
36 "",
37 f"""
38 <div>
39 <div
40 id="{container_id}"
41 class="interactive widget-container"
42 style="margin-bottom: {self.options.get("margin", 0)}px;"
43 />
44 <script type="module">
45 import {{ mountWidgetExample }} from "{_REACTPY_STATIC_HOST}/_static/custom.js";
46 mountWidgetExample(
47 "{container_id}",
48 "{view_id}",
49 "{_REACTPY_EXAMPLE_HOST}",
50 {"true" if "activate-button" in self.options else "false"},
51 );
52 </script>
53 </div>
54 """,
55 format="html",
56 )
57 ]
58
59
60def setup(app: Sphinx) -> None:

Callers

nothing calls this directly

Calls 2

getMethod · 0.45

Tested by

no test coverage detected