instruction stringlengths 0 1k | input stringlengths 1 1k | output stringlengths 10 6.51k |
|---|---|---|
demo without showing the code."""
starting_indicator = "```python demo-only"
ending_indicator = "```"
include_indicators = True
theme: str = None
def render(self, env) -> rx.Component:
lines = self.get_lines(env)
code = "\n".join(lines[1:-1])
args = lines[0].removeprefix(... |
data, code = parts[0], parts[1] + parts[2]
comp = docgraphing(code, comp=comp, data=data)
return comp
elif exec_mode:
return comp
elif "box" in args:
comp = eval(code, env, env)
return rx.box(comp, margin_bottom="1em", ... | parts = code.rpartition("def") |
g_indicator = "```python demo-only"
ending_indicator = "```"
include_indicators = True
theme: str = None
def render(self, env) -> rx.Component:
lines = self.get_lines(env)
code = "\n".join(lines[1:-1])
args = lines[0].removeprefix(self.starting_indicator).split()
exec_... |
comp = docgraphing(code, comp=comp, data=data)
return comp
elif exec_mode:
return comp
elif "box" in args:
comp = eval(code, env, env)
return rx.box(comp, margin_bottom="1em", id=comp_id)
else:
comp = eval(code, env... | data, code = parts[0], parts[1] + parts[2] |
"```"
include_indicators = True
theme: str = None
def render(self, env) -> rx.Component:
lines = self.get_lines(env)
code = "\n".join(lines[1:-1])
args = lines[0].removeprefix(self.starting_indicator).split()
exec_mode = env.get("__exec", False)
comp = ""
... |
return comp
elif exec_mode:
return comp
elif "box" in args:
comp = eval(code, env, env)
return rx.box(comp, margin_bottom="1em", id=comp_id)
else:
comp = eval(code, env, env)
# Return only the component without any code di... | comp = docgraphing(code, comp=comp, data=data) |
) -> rx.Component:
lines = self.get_lines(env)
code = "\n".join(lines[1:-1])
args = lines[0].removeprefix(self.starting_indicator).split()
exec_mode = env.get("__exec", False)
comp = ""
for arg in args:
if arg.startswith("id="):
comp_id = ar... |
# Return only the component without any code display
return rx.box(comp, margin_bottom="1em", id=comp_id)
class DemoBlock(flexdown.blocks.Block):
"""A block that displays a component along with its code."""
starting_indicator = "```python demo"
ending_indicator = "```"
include_indic... | elif exec_mode:
return comp
elif "box" in args:
comp = eval(code, env, env)
return rx.box(comp, margin_bottom="1em", id=comp_id)
else:
comp = eval(code, env, env) |
s(env)
code = "\n".join(lines[1:-1])
args = lines[0].removeprefix(self.starting_indicator).split()
exec_mode = env.get("__exec", False)
comp = ""
for arg in args:
if arg.startswith("id="):
comp_id = arg.rsplit("id=")[-1]
break
... |
# Return only the component without any code display
return rx.box(comp, margin_bottom="1em", id=comp_id)
class DemoBlock(flexdown.blocks.Block):
"""A block that displays a component along with its code."""
starting_indicator = "```python demo"
ending_indicator = "```"
include_indic... | elif "box" in args:
comp = eval(code, env, env)
return rx.box(comp, margin_bottom="1em", id=comp_id)
else:
comp = eval(code, env, env) |
lines[1:-1])
args = lines[0].removeprefix(self.starting_indicator).split()
exec_mode = env.get("__exec", False)
comp = ""
for arg in args:
if arg.startswith("id="):
comp_id = arg.rsplit("id=")[-1]
break
else:
comp_id = No... |
return rx.box(comp, margin_bottom="1em", id=comp_id)
else:
comp = eval(code, env, env)
# Return only the component without any code display
return rx.box(comp, margin_bottom="1em", id=comp_id)
class DemoBlock(flexdown.blocks.Block):
"""A block that displays a comp... | comp = eval(code, env, env) |
c", False)
comp = ""
for arg in args:
if arg.startswith("id="):
comp_id = arg.rsplit("id=")[-1]
break
else:
comp_id = None
if "exec" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
... |
# Return only the component without any code display
return rx.box(comp, margin_bottom="1em", id=comp_id)
class DemoBlock(flexdown.blocks.Block):
"""A block that displays a component along with its code."""
starting_indicator = "```python demo"
ending_indicator = "```"
include_indic... | comp = eval(code, env, env) |
break
else:
comp_id = None
if "exec" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
comp = env[list(env.keys())[-1]]()
elif "graphing" in args:
env["__xd"].exec(code, env, self.filename)
if no... |
class DemoBlockDark(DemoBlock):
theme = "dark"
class VideoBlock(flexdown.blocks.MarkdownBlock):
"""A block that displays a video."""
starting_indicator = "```md video"
ending_indicator = "```"
include_indicators = True
def render(self, env) -> rx.Component:
lines = self.get_lines... | class DemoBlock(flexdown.blocks.Block):
"""A block that displays a component along with its code."""
starting_indicator = "```python demo"
ending_indicator = "```"
include_indicators = True
theme: str = None
def render(self, env) -> rx.Component:
lines = self.get_lines(env)
cod... |
de, env, self.filename)
if not exec_mode:
comp = env[list(env.keys())[-1]]()
elif "graphing" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
comp = env[list(env.keys())[-1]]()
# Get all the code before the ... |
ending_indicator = "```"
include_indicators = True
theme: str = None
def render(self, env) -> rx.Component:
lines = self.get_lines(env)
code = "\n".join(lines[1:-1])
args = lines[0].removeprefix(self.starting_indicator).split()
exec_mode = env.get("__exec", False)
... | starting_indicator = "```python demo" |
exec_mode:
comp = env[list(env.keys())[-1]]()
elif "graphing" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
comp = env[list(env.keys())[-1]]()
# Get all the code before the final "def".
parts = code.... |
include_indicators = True
theme: str = None
def render(self, env) -> rx.Component:
lines = self.get_lines(env)
code = "\n".join(lines[1:-1])
args = lines[0].removeprefix(self.starting_indicator).split()
exec_mode = env.get("__exec", False)
comp = ""
for a... | ending_indicator = "```" |
omp = env[list(env.keys())[-1]]()
elif "graphing" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
comp = env[list(env.keys())[-1]]()
# Get all the code before the final "def".
parts = code.rpartition("def")
... |
theme: str = None
def render(self, env) -> rx.Component:
lines = self.get_lines(env)
code = "\n".join(lines[1:-1])
args = lines[0].removeprefix(self.starting_indicator).split()
exec_mode = env.get("__exec", False)
comp = ""
for arg in args:
if arg... | include_indicators = True |
ing" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
comp = env[list(env.keys())[-1]]()
# Get all the code before the final "def".
parts = code.rpartition("def")
data, code = parts[0], parts[1] + parts[2]
... |
class DemoBlockDark(DemoBlock):
theme = "dark"
class VideoBlock(flexdown.blocks.MarkdownBlock):
"""A block that displays a video."""
starting_indicator = "```md video"
ending_indicator = "```"
include_indicators = True
def render(self, env) -> rx.Component:
lines = self.get_lines... | def render(self, env) -> rx.Component:
lines = self.get_lines(env)
code = "\n".join(lines[1:-1])
args = lines[0].removeprefix(self.starting_indicator).split()
exec_mode = env.get("__exec", False)
comp = ""
for arg in args:
if arg.startswith("id="):
... |
, env, self.filename)
if not exec_mode:
comp = env[list(env.keys())[-1]]()
# Get all the code before the final "def".
parts = code.rpartition("def")
data, code = parts[0], parts[1] + parts[2]
comp = docgraphing(code, comp=comp, ... |
code = "\n".join(lines[1:-1])
args = lines[0].removeprefix(self.starting_indicator).split()
exec_mode = env.get("__exec", False)
comp = ""
for arg in args:
if arg.startswith("id="):
comp_id = arg.rsplit("id=")[-1]
break
else... | lines = self.get_lines(env) |
not exec_mode:
comp = env[list(env.keys())[-1]]()
# Get all the code before the final "def".
parts = code.rpartition("def")
data, code = parts[0], parts[1] + parts[2]
comp = docgraphing(code, comp=comp, data=data)
return co... |
args = lines[0].removeprefix(self.starting_indicator).split()
exec_mode = env.get("__exec", False)
comp = ""
for arg in args:
if arg.startswith("id="):
comp_id = arg.rsplit("id=")[-1]
break
else:
comp_id = None
... | code = "\n".join(lines[1:-1]) |
env[list(env.keys())[-1]]()
# Get all the code before the final "def".
parts = code.rpartition("def")
data, code = parts[0], parts[1] + parts[2]
comp = docgraphing(code, comp=comp, data=data)
return comp
elif exec_mode:
... |
exec_mode = env.get("__exec", False)
comp = ""
for arg in args:
if arg.startswith("id="):
comp_id = arg.rsplit("id=")[-1]
break
else:
comp_id = None
if "exec" in args:
env["__xd"].exec(code, env, self.filenam... | args = lines[0].removeprefix(self.starting_indicator).split() |
he final "def".
parts = code.rpartition("def")
data, code = parts[0], parts[1] + parts[2]
comp = docgraphing(code, comp=comp, data=data)
return comp
elif exec_mode:
return comp
elif "box" in args:
comp = eval(code, e... |
comp = ""
for arg in args:
if arg.startswith("id="):
comp_id = arg.rsplit("id=")[-1]
break
else:
comp_id = None
if "exec" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
... | exec_mode = env.get("__exec", False) |
data, code = parts[0], parts[1] + parts[2]
comp = docgraphing(code, comp=comp, data=data)
return comp
elif exec_mode:
return comp
elif "box" in args:
comp = eval(code, env, env)
return rx.box(comp, margin_bottom="1em", id... |
if "exec" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
comp = env[list(env.keys())[-1]]()
elif "graphing" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
comp = env[list(env.k... | for arg in args:
if arg.startswith("id="):
comp_id = arg.rsplit("id=")[-1]
break
else:
comp_id = None |
arts[0], parts[1] + parts[2]
comp = docgraphing(code, comp=comp, data=data)
return comp
elif exec_mode:
return comp
elif "box" in args:
comp = eval(code, env, env)
return rx.box(comp, margin_bottom="1em", id=comp_id)
else:
... |
else:
comp_id = None
if "exec" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
comp = env[list(env.keys())[-1]]()
elif "graphing" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mo... | if arg.startswith("id="):
comp_id = arg.rsplit("id=")[-1]
break |
comp = docgraphing(code, comp=comp, data=data)
return comp
elif exec_mode:
return comp
elif "box" in args:
comp = eval(code, env, env)
return rx.box(comp, margin_bottom="1em", id=comp_id)
else:
comp = eval(code, env, env)
... |
break
else:
comp_id = None
if "exec" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
comp = env[list(env.keys())[-1]]()
elif "graphing" in args:
env["__xd"].exec(code, env, self.filename)
... | comp_id = arg.rsplit("id=")[-1] |
elif exec_mode:
return comp
elif "box" in args:
comp = eval(code, env, env)
return rx.box(comp, margin_bottom="1em", id=comp_id)
else:
comp = eval(code, env, env)
# Return only the component without any code display
return rx.box(com... |
if "exec" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
comp = env[list(env.keys())[-1]]()
elif "graphing" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
comp = env[list(env.k... | comp_id = None |
return comp
elif "box" in args:
comp = eval(code, env, env)
return rx.box(comp, margin_bottom="1em", id=comp_id)
else:
comp = eval(code, env, env)
# Return only the component without any code display
return rx.box(comp, margin_bottom="1em", ... |
# Sweep up additional CSS-like props to apply to the demobox itself
demobox_props = {}
for arg in args:
prop, equals, value = arg.partition("=")
if equals:
demobox_props[prop] = value
if "toggle" in args:
demobox_props["toggle"] = Tr... | if "exec" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
comp = env[list(env.keys())[-1]]()
elif "graphing" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
comp = env[list(env.keys())[-1]... |
nv)
return rx.box(comp, margin_bottom="1em", id=comp_id)
else:
comp = eval(code, env, env)
# Return only the component without any code display
return rx.box(comp, margin_bottom="1em", id=comp_id)
class DemoBlock(flexdown.blocks.Block):
"""A block that displays a c... |
elif "graphing" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
comp = env[list(env.keys())[-1]]()
# Get all the code before the final "def".
parts = code.rpartition("def")
data, code = parts[0], parts... | if not exec_mode:
comp = env[list(env.keys())[-1]]() |
, margin_bottom="1em", id=comp_id)
else:
comp = eval(code, env, env)
# Return only the component without any code display
return rx.box(comp, margin_bottom="1em", id=comp_id)
class DemoBlock(flexdown.blocks.Block):
"""A block that displays a component along with its code."""
... |
elif "graphing" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
comp = env[list(env.keys())[-1]]()
# Get all the code before the final "def".
parts = code.rpartition("def")
data, code = parts[0], parts... | comp = env[list(env.keys())[-1]]() |
else:
comp = eval(code, env, env)
# Return only the component without any code display
return rx.box(comp, margin_bottom="1em", id=comp_id)
class DemoBlock(flexdown.blocks.Block):
"""A block that displays a component along with its code."""
starting_indicator = "```python demo"
... |
# Sweep up additional CSS-like props to apply to the demobox itself
demobox_props = {}
for arg in args:
prop, equals, value = arg.partition("=")
if equals:
demobox_props[prop] = value
if "toggle" in args:
demobox_props["toggle"] = Tr... | elif "graphing" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
comp = env[list(env.keys())[-1]]()
# Get all the code before the final "def".
parts = code.rpartition("def")
data, code = parts[0], parts[1] + par... |
ny code display
return rx.box(comp, margin_bottom="1em", id=comp_id)
class DemoBlock(flexdown.blocks.Block):
"""A block that displays a component along with its code."""
starting_indicator = "```python demo"
ending_indicator = "```"
include_indicators = True
theme: str = None
def ren... |
elif exec_mode:
return comp
elif "box" in args:
comp = eval(code, env, env)
return rx.box(docdemobox(comp), margin_bottom="1em", id=comp_id)
else:
comp = eval(code, env, env)
# Sweep up additional CSS-like props to apply to the demobox it... | if not exec_mode:
comp = env[list(env.keys())[-1]]()
# Get all the code before the final "def".
parts = code.rpartition("def")
data, code = parts[0], parts[1] + parts[2]
comp = docgraphing(code, comp=comp, data=data)
return ... |
box(comp, margin_bottom="1em", id=comp_id)
class DemoBlock(flexdown.blocks.Block):
"""A block that displays a component along with its code."""
starting_indicator = "```python demo"
ending_indicator = "```"
include_indicators = True
theme: str = None
def render(self, env) -> rx.Component:
... |
# Get all the code before the final "def".
parts = code.rpartition("def")
data, code = parts[0], parts[1] + parts[2]
comp = docgraphing(code, comp=comp, data=data)
return comp
elif exec_mode:
return comp
elif "b... | comp = env[list(env.keys())[-1]]() |
ays a component along with its code."""
starting_indicator = "```python demo"
ending_indicator = "```"
include_indicators = True
theme: str = None
def render(self, env) -> rx.Component:
lines = self.get_lines(env)
code = "\n".join(lines[1:-1])
args = lines[0].removeprefix(... |
data, code = parts[0], parts[1] + parts[2]
comp = docgraphing(code, comp=comp, data=data)
return comp
elif exec_mode:
return comp
elif "box" in args:
comp = eval(code, env, env)
return rx.box(docdemobox(comp), margin_bo... | parts = code.rpartition("def") |
arting_indicator = "```python demo"
ending_indicator = "```"
include_indicators = True
theme: str = None
def render(self, env) -> rx.Component:
lines = self.get_lines(env)
code = "\n".join(lines[1:-1])
args = lines[0].removeprefix(self.starting_indicator).split()
exec_... |
comp = docgraphing(code, comp=comp, data=data)
return comp
elif exec_mode:
return comp
elif "box" in args:
comp = eval(code, env, env)
return rx.box(docdemobox(comp), margin_bottom="1em", id=comp_id)
else:
comp = ev... | data, code = parts[0], parts[1] + parts[2] |
"```"
include_indicators = True
theme: str = None
def render(self, env) -> rx.Component:
lines = self.get_lines(env)
code = "\n".join(lines[1:-1])
args = lines[0].removeprefix(self.starting_indicator).split()
exec_mode = env.get("__exec", False)
comp = ""
... |
return comp
elif exec_mode:
return comp
elif "box" in args:
comp = eval(code, env, env)
return rx.box(docdemobox(comp), margin_bottom="1em", id=comp_id)
else:
comp = eval(code, env, env)
# Sweep up additional CSS-like prop... | comp = docgraphing(code, comp=comp, data=data) |
) -> rx.Component:
lines = self.get_lines(env)
code = "\n".join(lines[1:-1])
args = lines[0].removeprefix(self.starting_indicator).split()
exec_mode = env.get("__exec", False)
comp = ""
for arg in args:
if arg.startswith("id="):
comp_id = ar... |
# Sweep up additional CSS-like props to apply to the demobox itself
demobox_props = {}
for arg in args:
prop, equals, value = arg.partition("=")
if equals:
demobox_props[prop] = value
if "toggle" in args:
demobox_props["toggle"] = Tr... | elif exec_mode:
return comp
elif "box" in args:
comp = eval(code, env, env)
return rx.box(docdemobox(comp), margin_bottom="1em", id=comp_id)
else:
comp = eval(code, env, env) |
s(env)
code = "\n".join(lines[1:-1])
args = lines[0].removeprefix(self.starting_indicator).split()
exec_mode = env.get("__exec", False)
comp = ""
for arg in args:
if arg.startswith("id="):
comp_id = arg.rsplit("id=")[-1]
break
... |
# Sweep up additional CSS-like props to apply to the demobox itself
demobox_props = {}
for arg in args:
prop, equals, value = arg.partition("=")
if equals:
demobox_props[prop] = value
if "toggle" in args:
demobox_props["toggle"] = Tr... | elif "box" in args:
comp = eval(code, env, env)
return rx.box(docdemobox(comp), margin_bottom="1em", id=comp_id)
else:
comp = eval(code, env, env) |
lines[1:-1])
args = lines[0].removeprefix(self.starting_indicator).split()
exec_mode = env.get("__exec", False)
comp = ""
for arg in args:
if arg.startswith("id="):
comp_id = arg.rsplit("id=")[-1]
break
else:
comp_id = No... |
return rx.box(docdemobox(comp), margin_bottom="1em", id=comp_id)
else:
comp = eval(code, env, env)
# Sweep up additional CSS-like props to apply to the demobox itself
demobox_props = {}
for arg in args:
prop, equals, value = arg.partition("=")
... | comp = eval(code, env, env) |
comp = ""
for arg in args:
if arg.startswith("id="):
comp_id = arg.rsplit("id=")[-1]
break
else:
comp_id = None
if "exec" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
... |
# Sweep up additional CSS-like props to apply to the demobox itself
demobox_props = {}
for arg in args:
prop, equals, value = arg.partition("=")
if equals:
demobox_props[prop] = value
if "toggle" in args:
demobox_props["toggle"] = Tr... | comp = eval(code, env, env) |
plit("id=")[-1]
break
else:
comp_id = None
if "exec" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
comp = env[list(env.keys())[-1]]()
elif "graphing" in args:
env["__xd"].exec(code, env, self... |
for arg in args:
prop, equals, value = arg.partition("=")
if equals:
demobox_props[prop] = value
if "toggle" in args:
demobox_props["toggle"] = True
return docdemo(
code, comp=comp, demobox_props=demobox_props, theme=self.theme, ... | demobox_props = {} |
break
else:
comp_id = None
if "exec" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
comp = env[list(env.keys())[-1]]()
elif "graphing" in args:
env["__xd"].exec(code, env, self.filename)
if n... |
if "toggle" in args:
demobox_props["toggle"] = True
return docdemo(
code, comp=comp, demobox_props=demobox_props, theme=self.theme, id=comp_id
)
class DemoBlockDark(DemoBlock):
theme = "dark"
class VideoBlock(flexdown.blocks.MarkdownBlock):
"""A block that ... | for arg in args:
prop, equals, value = arg.partition("=")
if equals:
demobox_props[prop] = value |
comp_id = None
if "exec" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
comp = env[list(env.keys())[-1]]()
elif "graphing" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
... |
if equals:
demobox_props[prop] = value
if "toggle" in args:
demobox_props["toggle"] = True
return docdemo(
code, comp=comp, demobox_props=demobox_props, theme=self.theme, id=comp_id
)
class DemoBlockDark(DemoBlock):
theme = "dark"
cl... | prop, equals, value = arg.partition("=") |
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
comp = env[list(env.keys())[-1]]()
elif "graphing" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
comp = env[list(env.keys())[-1]]()
#... |
if "toggle" in args:
demobox_props["toggle"] = True
return docdemo(
code, comp=comp, demobox_props=demobox_props, theme=self.theme, id=comp_id
)
class DemoBlockDark(DemoBlock):
theme = "dark"
class VideoBlock(flexdown.blocks.MarkdownBlock):
"""A block that ... | if equals:
demobox_props[prop] = value |
code, env, self.filename)
if not exec_mode:
comp = env[list(env.keys())[-1]]()
elif "graphing" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
comp = env[list(env.keys())[-1]]()
# Get all the code before th... |
if "toggle" in args:
demobox_props["toggle"] = True
return docdemo(
code, comp=comp, demobox_props=demobox_props, theme=self.theme, id=comp_id
)
class DemoBlockDark(DemoBlock):
theme = "dark"
class VideoBlock(flexdown.blocks.MarkdownBlock):
"""A block that ... | demobox_props[prop] = value |
if not exec_mode:
comp = env[list(env.keys())[-1]]()
elif "graphing" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
comp = env[list(env.keys())[-1]]()
# Get all the code before the final "def".
parts ... |
return docdemo(
code, comp=comp, demobox_props=demobox_props, theme=self.theme, id=comp_id
)
class DemoBlockDark(DemoBlock):
theme = "dark"
class VideoBlock(flexdown.blocks.MarkdownBlock):
"""A block that displays a video."""
starting_indicator = "```md video"
ending_i... | if "toggle" in args:
demobox_props["toggle"] = True |
comp = env[list(env.keys())[-1]]()
elif "graphing" in args:
env["__xd"].exec(code, env, self.filename)
if not exec_mode:
comp = env[list(env.keys())[-1]]()
# Get all the code before the final "def".
parts = code.rpartition("def")
... |
return docdemo(
code, comp=comp, demobox_props=demobox_props, theme=self.theme, id=comp_id
)
class DemoBlockDark(DemoBlock):
theme = "dark"
class VideoBlock(flexdown.blocks.MarkdownBlock):
"""A block that displays a video."""
starting_indicator = "```md video"
ending_i... | demobox_props["toggle"] = True |
comp = env[list(env.keys())[-1]]()
# Get all the code before the final "def".
parts = code.rpartition("def")
data, code = parts[0], parts[1] + parts[2]
comp = docgraphing(code, comp=comp, data=data)
return comp
elif ... |
class VideoBlock(flexdown.blocks.MarkdownBlock):
"""A block that displays a video."""
starting_indicator = "```md video"
ending_indicator = "```"
include_indicators = True
def render(self, env) -> rx.Component:
lines = self.get_lines(env)
args = lines[0].removeprefix(self.star... | class DemoBlockDark(DemoBlock):
theme = "dark" |
keys())[-1]]()
# Get all the code before the final "def".
parts = code.rpartition("def")
data, code = parts[0], parts[1] + parts[2]
comp = docgraphing(code, comp=comp, data=data)
return comp
elif exec_mode:
return comp
... |
class VideoBlock(flexdown.blocks.MarkdownBlock):
"""A block that displays a video."""
starting_indicator = "```md video"
ending_indicator = "```"
include_indicators = True
def render(self, env) -> rx.Component:
lines = self.get_lines(env)
args = lines[0].removeprefix(self.star... | theme = "dark" |
n("def")
data, code = parts[0], parts[1] + parts[2]
comp = docgraphing(code, comp=comp, data=data)
return comp
elif exec_mode:
return comp
elif "box" in args:
comp = eval(code, env, env)
return rx.box(docdemobox(comp), m... |
ending_indicator = "```"
include_indicators = True
def render(self, env) -> rx.Component:
lines = self.get_lines(env)
args = lines[0].removeprefix(self.starting_indicator).split()
if len(args) == 0:
args = ["info"]
url = args[0]
title = lines[1].stri... | starting_indicator = "```md video" |
arts[0], parts[1] + parts[2]
comp = docgraphing(code, comp=comp, data=data)
return comp
elif exec_mode:
return comp
elif "box" in args:
comp = eval(code, env, env)
return rx.box(docdemobox(comp), margin_bottom="1em", id=comp_id)
... |
include_indicators = True
def render(self, env) -> rx.Component:
lines = self.get_lines(env)
args = lines[0].removeprefix(self.starting_indicator).split()
if len(args) == 0:
args = ["info"]
url = args[0]
title = lines[1].strip("#").strip() if lines[1].st... | ending_indicator = "```" |
comp = docgraphing(code, comp=comp, data=data)
return comp
elif exec_mode:
return comp
elif "box" in args:
comp = eval(code, env, env)
return rx.box(docdemobox(comp), margin_bottom="1em", id=comp_id)
else:
comp = eval... |
def render(self, env) -> rx.Component:
lines = self.get_lines(env)
args = lines[0].removeprefix(self.starting_indicator).split()
if len(args) == 0:
args = ["info"]
url = args[0]
title = lines[1].strip("#").strip() if lines[1].startswith("#") else ""
... | include_indicators = True |
return comp
elif exec_mode:
return comp
elif "box" in args:
comp = eval(code, env, env)
return rx.box(docdemobox(comp), margin_bottom="1em", id=comp_id)
else:
comp = eval(code, env, env)
# Sweep up additional CSS-like props to apply to the... |
args = lines[0].removeprefix(self.starting_indicator).split()
if len(args) == 0:
args = ["info"]
url = args[0]
title = lines[1].strip("#").strip() if lines[1].startswith("#") else ""
color = "blue"
return rx.box(
rx.accordion.root(
... | lines = self.get_lines(env) |
return comp
elif "box" in args:
comp = eval(code, env, env)
return rx.box(docdemobox(comp), margin_bottom="1em", id=comp_id)
else:
comp = eval(code, env, env)
# Sweep up additional CSS-like props to apply to the demobox itself
demobox_props... |
if len(args) == 0:
args = ["info"]
url = args[0]
title = lines[1].strip("#").strip() if lines[1].startswith("#") else ""
color = "blue"
return rx.box(
rx.accordion.root(
rx.accordion.item(
rx.accordion.header(
... | args = lines[0].removeprefix(self.starting_indicator).split() |
val(code, env, env)
return rx.box(docdemobox(comp), margin_bottom="1em", id=comp_id)
else:
comp = eval(code, env, env)
# Sweep up additional CSS-like props to apply to the demobox itself
demobox_props = {}
for arg in args:
prop, equals, value = arg.pa... |
url = args[0]
title = lines[1].strip("#").strip() if lines[1].startswith("#") else ""
color = "blue"
return rx.box(
rx.accordion.root(
rx.accordion.item(
rx.accordion.header(
rx.accordion.trigger(
... | if len(args) == 0:
args = ["info"] |
return rx.box(docdemobox(comp), margin_bottom="1em", id=comp_id)
else:
comp = eval(code, env, env)
# Sweep up additional CSS-like props to apply to the demobox itself
demobox_props = {}
for arg in args:
prop, equals, value = arg.partition("=")
if equ... |
url = args[0]
title = lines[1].strip("#").strip() if lines[1].startswith("#") else ""
color = "blue"
return rx.box(
rx.accordion.root(
rx.accordion.item(
rx.accordion.header(
rx.accordion.trigger(
... | args = ["info"] |
x(comp), margin_bottom="1em", id=comp_id)
else:
comp = eval(code, env, env)
# Sweep up additional CSS-like props to apply to the demobox itself
demobox_props = {}
for arg in args:
prop, equals, value = arg.partition("=")
if equals:
dem... |
title = lines[1].strip("#").strip() if lines[1].startswith("#") else ""
color = "blue"
return rx.box(
rx.accordion.root(
rx.accordion.item(
rx.accordion.header(
rx.accordion.trigger(
rx.hstack... | url = args[0] |
"1em", id=comp_id)
else:
comp = eval(code, env, env)
# Sweep up additional CSS-like props to apply to the demobox itself
demobox_props = {}
for arg in args:
prop, equals, value = arg.partition("=")
if equals:
demobox_props[prop] = valu... |
color = "blue"
return rx.box(
rx.accordion.root(
rx.accordion.item(
rx.accordion.header(
rx.accordion.trigger(
rx.hstack(
(
markdown_... | title = lines[1].strip("#").strip() if lines[1].startswith("#") else "" |
# Sweep up additional CSS-like props to apply to the demobox itself
demobox_props = {}
for arg in args:
prop, equals, value = arg.partition("=")
if equals:
demobox_props[prop] = value
if "toggle" in args:
demobox_props["toggle"] = True
... |
return rx.box(
rx.accordion.root(
rx.accordion.item(
rx.accordion.header(
rx.accordion.trigger(
rx.hstack(
(
markdown_with_shiki(
... | color = "blue" |
width="100%",
height="500px",
border_radius="10px",
overflow="hidden",
),
margin_top="16px",
padding="0px",
),
... |
class TabsBlock(flexdown.blocks.Block):
"""A block that displays content in tabs."""
starting_indicator = "---md tabs"
ending_indicator = "---"
def render(self, env) -> rx.Component:
lines = self.get_lines(env)
tab_sections = []
current_section = []
current_title = ... | class QuoteBlock(flexdown.blocks.MarkdownBlock):
"""A block that displays a quote."""
starting_indicator = "```md quote"
ending_indicator = "```"
include_indicators = True
def render(self, env) -> rx.Component:
lines = self.get_lines(env)
quote_content = []
name = ""
... |
border_radius="10px",
overflow="hidden",
),
margin_top="16px",
padding="0px",
),
border_radius="0px",
border="none",
background_col... |
ending_indicator = "```"
include_indicators = True
def render(self, env) -> rx.Component:
lines = self.get_lines(env)
quote_content = []
name = ""
role = ""
for line in lines[1:-1]: # Skip the first and last lines (indicators)
if line.startswith("- nam... | starting_indicator = "```md quote" |
overflow="hidden",
),
margin_top="16px",
padding="0px",
),
border_radius="0px",
border="none",
background_color="transparent",
p... |
include_indicators = True
def render(self, env) -> rx.Component:
lines = self.get_lines(env)
quote_content = []
name = ""
role = ""
for line in lines[1:-1]: # Skip the first and last lines (indicators)
if line.startswith("- name:"):
name = ... | ending_indicator = "```" |
hidden",
),
margin_top="16px",
padding="0px",
),
border_radius="0px",
border="none",
background_color="transparent",
padding=["16px", "24px"],
... |
def render(self, env) -> rx.Component:
lines = self.get_lines(env)
quote_content = []
name = ""
role = ""
for line in lines[1:-1]: # Skip the first and last lines (indicators)
if line.startswith("- name:"):
name = line.split(":", 1)[1].strip()
... | include_indicators = True |
),
margin_top="16px",
padding="0px",
),
border_radius="0px",
border="none",
background_color="transparent",
padding=["16px", "24px"],
),
b... |
class TabsBlock(flexdown.blocks.Block):
"""A block that displays content in tabs."""
starting_indicator = "---md tabs"
ending_indicator = "---"
def render(self, env) -> rx.Component:
lines = self.get_lines(env)
tab_sections = []
current_section = []
current_title = ... | def render(self, env) -> rx.Component:
lines = self.get_lines(env)
quote_content = []
name = ""
role = ""
for line in lines[1:-1]: # Skip the first and last lines (indicators)
if line.startswith("- name:"):
name = line.split(":", 1)[1].strip()
... |
padding="0px",
),
border_radius="0px",
border="none",
background_color="transparent",
padding=["16px", "24px"],
),
background="transparent !important",
... |
quote_content = []
name = ""
role = ""
for line in lines[1:-1]: # Skip the first and last lines (indicators)
if line.startswith("- name:"):
name = line.split(":", 1)[1].strip()
elif line.startswith("- role:"):
role = line.split(":... | lines = self.get_lines(env) |
x",
),
border_radius="0px",
border="none",
background_color="transparent",
padding=["16px", "24px"],
),
background="transparent !important",
box_shadow="none !important",
... |
name = ""
role = ""
for line in lines[1:-1]: # Skip the first and last lines (indicators)
if line.startswith("- name:"):
name = line.split(":", 1)[1].strip()
elif line.startswith("- role:"):
role = line.split(":", 1)[1].strip()
... | quote_content = [] |
px",
border="none",
background_color="transparent",
padding=["16px", "24px"],
),
background="transparent !important",
box_shadow="none !important",
collapsible=True,
width="100%",
... |
quote_text = "\n".join(quote_content).strip()
return rx.box(
rx.text(f'"{quote_text}"', class_name="text-slate-11 font-base italic"),
rx.box(
rx.text(name, class_name="text-slate-11 font-base"),
rx.text(role, class_name="text-slate-10 font-base"... | for line in lines[1:-1]: # Skip the first and last lines (indicators)
if line.startswith("- name:"):
name = line.split(":", 1)[1].strip()
elif line.startswith("- role:"):
role = line.split(":", 1)[1].strip()
else:
quote_content.append(... |
parent",
padding=["16px", "24px"],
),
background="transparent !important",
box_shadow="none !important",
collapsible=True,
width="100%",
border_radius="0px",
),
border=f"1px solid ... |
quote_text = "\n".join(quote_content).strip()
return rx.box(
rx.text(f'"{quote_text}"', class_name="text-slate-11 font-base italic"),
rx.box(
rx.text(name, class_name="text-slate-11 font-base"),
rx.text(role, class_name="text-slate-10 font-base"... | if line.startswith("- name:"):
name = line.split(":", 1)[1].strip()
elif line.startswith("- role:"):
role = line.split(":", 1)[1].strip()
else:
quote_content.append(line) |
24px"],
),
background="transparent !important",
box_shadow="none !important",
collapsible=True,
width="100%",
border_radius="0px",
),
border=f"1px solid {rx.color(color, 4)}",
border_radiu... |
elif line.startswith("- role:"):
role = line.split(":", 1)[1].strip()
else:
quote_content.append(line)
quote_text = "\n".join(quote_content).strip()
return rx.box(
rx.text(f'"{quote_text}"', class_name="text-slate-11 font-base italic... | name = line.split(":", 1)[1].strip() |
ound="transparent !important",
box_shadow="none !important",
collapsible=True,
width="100%",
border_radius="0px",
),
border=f"1px solid {rx.color(color, 4)}",
border_radius="12px",
background_color=f"{rx.colo... |
quote_text = "\n".join(quote_content).strip()
return rx.box(
rx.text(f'"{quote_text}"', class_name="text-slate-11 font-base italic"),
rx.box(
rx.text(name, class_name="text-slate-11 font-base"),
rx.text(role, class_name="text-slate-10 font-base"... | elif line.startswith("- role:"):
role = line.split(":", 1)[1].strip()
else:
quote_content.append(line) |
x_shadow="none !important",
collapsible=True,
width="100%",
border_radius="0px",
),
border=f"1px solid {rx.color(color, 4)}",
border_radius="12px",
background_color=f"{rx.color(color, 3)} !important",
width="100%... |
else:
quote_content.append(line)
quote_text = "\n".join(quote_content).strip()
return rx.box(
rx.text(f'"{quote_text}"', class_name="text-slate-11 font-base italic"),
rx.box(
rx.text(name, class_name="text-slate-11 font-base"),
... | role = line.split(":", 1)[1].strip() |
border_radius="0px",
),
border=f"1px solid {rx.color(color, 4)}",
border_radius="12px",
background_color=f"{rx.color(color, 3)} !important",
width="100%",
margin_bottom="16px",
margin_top="16px",
overflow="hidden",
... |
return rx.box(
rx.text(f'"{quote_text}"', class_name="text-slate-11 font-base italic"),
rx.box(
rx.text(name, class_name="text-slate-11 font-base"),
rx.text(role, class_name="text-slate-10 font-base"),
class_name="flex flex-col gap-0.5",
... | quote_text = "\n".join(quote_content).strip() |
f.get_lines(env)
quote_content = []
name = ""
role = ""
for line in lines[1:-1]: # Skip the first and last lines (indicators)
if line.startswith("- name:"):
name = line.split(":", 1)[1].strip()
elif line.startswith("- role:"):
role... |
ending_indicator = "---"
def render(self, env) -> rx.Component:
lines = self.get_lines(env)
tab_sections = []
current_section = []
current_title = ""
for line in lines[1:-1]: # Skip the first and last lines (indicators)
stripped_line = line.strip()
... | starting_indicator = "---md tabs" |
= []
name = ""
role = ""
for line in lines[1:-1]: # Skip the first and last lines (indicators)
if line.startswith("- name:"):
name = line.split(":", 1)[1].strip()
elif line.startswith("- role:"):
role = line.split(":", 1)[1].strip()
... |
def render(self, env) -> rx.Component:
lines = self.get_lines(env)
tab_sections = []
current_section = []
current_title = ""
for line in lines[1:-1]: # Skip the first and last lines (indicators)
stripped_line = line.strip()
if stripped_line.start... | ending_indicator = "---" |
role = ""
for line in lines[1:-1]: # Skip the first and last lines (indicators)
if line.startswith("- name:"):
name = line.split(":", 1)[1].strip()
elif line.startswith("- role:"):
role = line.split(":", 1)[1].strip()
else:
q... |
component_map = {
"h1": lambda text: h1_comp_xd(text=text),
"h2": lambda text: h2_comp_xd(text=text),
"h3": lambda text: h3_comp_xd(text=text),
"h4": lambda text: h4_comp_xd(text=text),
"p": lambda text: text_comp(text=text),
"li": lambda text: list_comp(text=text),
"a": doclink2,
"co... | def render(self, env) -> rx.Component:
lines = self.get_lines(env)
tab_sections = []
current_section = []
current_title = ""
for line in lines[1:-1]: # Skip the first and last lines (indicators)
stripped_line = line.strip()
if stripped_line.startswith(... |
Skip the first and last lines (indicators)
if line.startswith("- name:"):
name = line.split(":", 1)[1].strip()
elif line.startswith("- role:"):
role = line.split(":", 1)[1].strip()
else:
quote_content.append(line)
quote_text =... |
tab_sections = []
current_section = []
current_title = ""
for line in lines[1:-1]: # Skip the first and last lines (indicators)
stripped_line = line.strip()
if stripped_line.startswith("--tab "):
if current_title:
tab_secti... | lines = self.get_lines(env) |
ators)
if line.startswith("- name:"):
name = line.split(":", 1)[1].strip()
elif line.startswith("- role:"):
role = line.split(":", 1)[1].strip()
else:
quote_content.append(line)
quote_text = "\n".join(quote_content).strip()
... |
current_section = []
current_title = ""
for line in lines[1:-1]: # Skip the first and last lines (indicators)
stripped_line = line.strip()
if stripped_line.startswith("--tab "):
if current_title:
tab_sections.append((current_title, ... | tab_sections = [] |
.startswith("- name:"):
name = line.split(":", 1)[1].strip()
elif line.startswith("- role:"):
role = line.split(":", 1)[1].strip()
else:
quote_content.append(line)
quote_text = "\n".join(quote_content).strip()
return rx.box(
... |
current_title = ""
for line in lines[1:-1]: # Skip the first and last lines (indicators)
stripped_line = line.strip()
if stripped_line.startswith("--tab "):
if current_title:
tab_sections.append((current_title, "\n".join(current_section)))
... | current_section = [] |
name = line.split(":", 1)[1].strip()
elif line.startswith("- role:"):
role = line.split(":", 1)[1].strip()
else:
quote_content.append(line)
quote_text = "\n".join(quote_content).strip()
return rx.box(
rx.text(f'"{quote_text... |
for line in lines[1:-1]: # Skip the first and last lines (indicators)
stripped_line = line.strip()
if stripped_line.startswith("--tab "):
if current_title:
tab_sections.append((current_title, "\n".join(current_section)))
current_tit... | current_title = "" |
(":", 1)[1].strip()
elif line.startswith("- role:"):
role = line.split(":", 1)[1].strip()
else:
quote_content.append(line)
quote_text = "\n".join(quote_content).strip()
return rx.box(
rx.text(f'"{quote_text}"', class_name="text-slate-... |
# Add the last section if there's content
if current_title and current_section:
tab_sections.append((current_title, "\n".join(current_section)))
# Create tab components
triggers = []
contents = []
for i, (title, content) in enumerate(tab_sections):
... | for line in lines[1:-1]: # Skip the first and last lines (indicators)
stripped_line = line.strip()
if stripped_line.startswith("--tab "):
if current_title:
tab_sections.append((current_title, "\n".join(current_section)))
current_title = strip... |
le = line.split(":", 1)[1].strip()
else:
quote_content.append(line)
quote_text = "\n".join(quote_content).strip()
return rx.box(
rx.text(f'"{quote_text}"', class_name="text-slate-11 font-base italic"),
rx.box(
rx.text(name, class_name... |
if stripped_line.startswith("--tab "):
if current_title:
tab_sections.append((current_title, "\n".join(current_section)))
current_title = stripped_line[6:].strip()
current_section = []
elif stripped_line == "--":
... | stripped_line = line.strip() |
else:
quote_content.append(line)
quote_text = "\n".join(quote_content).strip()
return rx.box(
rx.text(f'"{quote_text}"', class_name="text-slate-11 font-base italic"),
rx.box(
rx.text(name, class_name="text-slate-11 font-base"),
... |
# Add the last section if there's content
if current_title and current_section:
tab_sections.append((current_title, "\n".join(current_section)))
# Create tab components
triggers = []
contents = []
for i, (title, content) in enumerate(tab_sections):
... | if stripped_line.startswith("--tab "):
if current_title:
tab_sections.append((current_title, "\n".join(current_section)))
current_title = stripped_line[6:].strip()
current_section = []
elif stripped_line == "--":
if current_... |
quote_text = "\n".join(quote_content).strip()
return rx.box(
rx.text(f'"{quote_text}"', class_name="text-slate-11 font-base italic"),
rx.box(
rx.text(name, class_name="text-slate-11 font-base"),
rx.text(role, class_name="text-slate-10 font-base"),... |
current_title = stripped_line[6:].strip()
current_section = []
elif stripped_line == "--":
if current_title:
tab_sections.append((current_title, "\n".join(current_section)))
current_title = ""
curren... | if current_title:
tab_sections.append((current_title, "\n".join(current_section))) |
ass_name="text-slate-11 font-base italic"),
rx.box(
rx.text(name, class_name="text-slate-11 font-base"),
rx.text(role, class_name="text-slate-10 font-base"),
class_name="flex flex-col gap-0.5",
),
class_name="flex flex-col gap-4 border-... |
current_section = []
elif stripped_line == "--":
if current_title:
tab_sections.append((current_title, "\n".join(current_section)))
current_title = ""
current_section = []
else:
current_s... | current_title = stripped_line[6:].strip() |
.box(
rx.text(name, class_name="text-slate-11 font-base"),
rx.text(role, class_name="text-slate-10 font-base"),
class_name="flex flex-col gap-0.5",
),
class_name="flex flex-col gap-4 border-l-[3px] border-slate-4 pl-6 mt-2 mb-6",
)
class ... |
elif stripped_line == "--":
if current_title:
tab_sections.append((current_title, "\n".join(current_section)))
current_title = ""
current_section = []
else:
current_section.append(line)
# Add th... | current_section = [] |
e, class_name="text-slate-11 font-base"),
rx.text(role, class_name="text-slate-10 font-base"),
class_name="flex flex-col gap-0.5",
),
class_name="flex flex-col gap-4 border-l-[3px] border-slate-4 pl-6 mt-2 mb-6",
)
class TabsBlock(flexdown.blocks.Block):... |
# Add the last section if there's content
if current_title and current_section:
tab_sections.append((current_title, "\n".join(current_section)))
# Create tab components
triggers = []
contents = []
for i, (title, content) in enumerate(tab_sections):
... | elif stripped_line == "--":
if current_title:
tab_sections.append((current_title, "\n".join(current_section)))
current_title = ""
current_section = []
else:
current_section.append(line) |
rx.text(role, class_name="text-slate-10 font-base"),
class_name="flex flex-col gap-0.5",
),
class_name="flex flex-col gap-4 border-l-[3px] border-slate-4 pl-6 mt-2 mb-6",
)
class TabsBlock(flexdown.blocks.Block):
"""A block that displays content in tab... |
else:
current_section.append(line)
# Add the last section if there's content
if current_title and current_section:
tab_sections.append((current_title, "\n".join(current_section)))
# Create tab components
triggers = []
contents = []
... | if current_title:
tab_sections.append((current_title, "\n".join(current_section)))
current_title = ""
current_section = [] |
),
class_name="flex flex-col gap-4 border-l-[3px] border-slate-4 pl-6 mt-2 mb-6",
)
class TabsBlock(flexdown.blocks.Block):
"""A block that displays content in tabs."""
starting_indicator = "---md tabs"
ending_indicator = "---"
def render(self, env) -> rx.Component:
... |
current_section = []
else:
current_section.append(line)
# Add the last section if there's content
if current_title and current_section:
tab_sections.append((current_title, "\n".join(current_section)))
# Create tab components
... | current_title = "" |
flex-col gap-4 border-l-[3px] border-slate-4 pl-6 mt-2 mb-6",
)
class TabsBlock(flexdown.blocks.Block):
"""A block that displays content in tabs."""
starting_indicator = "---md tabs"
ending_indicator = "---"
def render(self, env) -> rx.Component:
lines = self.get_lines(env)
... |
else:
current_section.append(line)
# Add the last section if there's content
if current_title and current_section:
tab_sections.append((current_title, "\n".join(current_section)))
# Create tab components
triggers = []
contents = []
... | current_section = [] |
content in tabs."""
starting_indicator = "---md tabs"
ending_indicator = "---"
def render(self, env) -> rx.Component:
lines = self.get_lines(env)
tab_sections = []
current_section = []
current_title = ""
for line in lines[1:-1]: # Skip the first and last lines (... |
# Create tab components
triggers = []
contents = []
for i, (title, content) in enumerate(tab_sections):
value = f"tab{i + 1}"
triggers.append(
rx.tabs.trigger(
title,
value=value,
class... | if current_title and current_section:
tab_sections.append((current_title, "\n".join(current_section))) |
t_lines(env)
tab_sections = []
current_section = []
current_title = ""
for line in lines[1:-1]: # Skip the first and last lines (indicators)
stripped_line = line.strip()
if stripped_line.startswith("--tab "):
if current_title:
... |
contents = []
for i, (title, content) in enumerate(tab_sections):
value = f"tab{i + 1}"
triggers.append(
rx.tabs.trigger(
title,
value=value,
class_name="tab-style font-base font-semibold text-[1.25rem]... | triggers = [] |
tab_sections = []
current_section = []
current_title = ""
for line in lines[1:-1]: # Skip the first and last lines (indicators)
stripped_line = line.strip()
if stripped_line.startswith("--tab "):
if current_title:
tab_sections.append... |
for i, (title, content) in enumerate(tab_sections):
value = f"tab{i + 1}"
triggers.append(
rx.tabs.trigger(
title,
value=value,
class_name="tab-style font-base font-semibold text-[1.25rem]",
)
... | contents = [] |
current_section = []
current_title = ""
for line in lines[1:-1]: # Skip the first and last lines (indicators)
stripped_line = line.strip()
if stripped_line.startswith("--tab "):
if current_title:
tab_sections.append((current_title, "\n".j... |
return rx.tabs.root(
rx.tabs.list(*triggers, class_name="mt-4"), *contents, default_value="tab1"
)
component_map = {
"h1": lambda text: h1_comp_xd(text=text),
"h2": lambda text: h2_comp_xd(text=text),
"h3": lambda text: h3_comp_xd(text=text),
"h4": lambda text: h4_comp_xd... | for i, (title, content) in enumerate(tab_sections):
value = f"tab{i + 1}"
triggers.append(
rx.tabs.trigger(
title,
value=value,
class_name="tab-style font-base font-semibold text-[1.25rem]",
)
... |
line in lines[1:-1]: # Skip the first and last lines (indicators)
stripped_line = line.strip()
if stripped_line.startswith("--tab "):
if current_title:
tab_sections.append((current_title, "\n".join(current_section)))
current_title = stripped_... |
triggers.append(
rx.tabs.trigger(
title,
value=value,
class_name="tab-style font-base font-semibold text-[1.25rem]",
)
)
# Render the tab content
tab_content = []
for... | value = f"tab{i + 1}" |
= stripped_line[6:].strip()
current_section = []
elif stripped_line == "--":
if current_title:
tab_sections.append((current_title, "\n".join(current_section)))
current_title = ""
current_section = []
else... |
for block in env["__xd"].get_blocks(content, self.filename):
if isinstance(block, flexdown.blocks.MarkdownBlock):
block.render_fn = env["__xd"].flexdown_memo
try:
tab_content.append(block.render(env=env))
except Excepti... | tab_content = [] |
current_section = []
elif stripped_line == "--":
if current_title:
tab_sections.append((current_title, "\n".join(current_section)))
current_title = ""
current_section = []
else:
current_sec... |
contents.append(rx.tabs.content(rx.fragment(*tab_content), value=value))
return rx.tabs.root(
rx.tabs.list(*triggers, class_name="mt-4"), *contents, default_value="tab1"
)
component_map = {
"h1": lambda text: h1_comp_xd(text=text),
"h2": lambda text: h2_comp_xd(text=... | for block in env["__xd"].get_blocks(content, self.filename):
if isinstance(block, flexdown.blocks.MarkdownBlock):
block.render_fn = env["__xd"].flexdown_memo
try:
tab_content.append(block.render(env=env))
except Exception:
... |
if current_title:
tab_sections.append((current_title, "\n".join(current_section)))
current_title = ""
current_section = []
else:
current_section.append(line)
# Add the last section if there's content
... |
try:
tab_content.append(block.render(env=env))
except Exception:
print(
f"Error while rendering {type(block)} on line {block.start_line_number}. "
f"\n{block.get_content(env)}"
)
... | if isinstance(block, flexdown.blocks.MarkdownBlock):
block.render_fn = env["__xd"].flexdown_memo |
(current_title, "\n".join(current_section)))
current_title = ""
current_section = []
else:
current_section.append(line)
# Add the last section if there's content
if current_title and current_section:
tab_sections.append((cu... |
try:
tab_content.append(block.render(env=env))
except Exception:
print(
f"Error while rendering {type(block)} on line {block.start_line_number}. "
f"\n{block.get_content(env)}"
)
... | block.render_fn = env["__xd"].flexdown_memo |
title,
value=value,
class_name="tab-style font-base font-semibold text-[1.25rem]",
)
)
# Render the tab content
tab_content = []
for block in env["__xd"].get_blocks(content, self.filename):
... |
comp2 = component_map.copy()
comp2["codeblock"] = code_block_markdown_dark
comp2["ul"] = lambda items: unordered_list_comp(items=items)
comp2["ol"] = lambda items: ordered_list_comp(items=items)
xd = flexdown.Flexdown(
block_types=[
DemoOnly,
DemoBlock,
AlertBlock,
DefinitionBlock... | component_map = {
"h1": lambda text: h1_comp_xd(text=text),
"h2": lambda text: h2_comp_xd(text=text),
"h3": lambda text: h3_comp_xd(text=text),
"h4": lambda text: h4_comp_xd(text=text),
"p": lambda text: text_comp(text=text),
"li": lambda text: list_comp(text=text),
"a": doclink2,
"code"... |
ock.render_fn = env["__xd"].flexdown_memo
try:
tab_content.append(block.render(env=env))
except Exception:
print(
f"Error while rendering {type(block)} on line {block.start_line_number}. "
f"\n{block.... |
comp2["codeblock"] = code_block_markdown_dark
comp2["ul"] = lambda items: unordered_list_comp(items=items)
comp2["ol"] = lambda items: ordered_list_comp(items=items)
xd = flexdown.Flexdown(
block_types=[
DemoOnly,
DemoBlock,
AlertBlock,
DefinitionBlock,
SectionBlock,
... | comp2 = component_map.copy() |
lexdown_memo
try:
tab_content.append(block.render(env=env))
except Exception:
print(
f"Error while rendering {type(block)} on line {block.start_line_number}. "
f"\n{block.get_content(env)}"
... |
comp2["ul"] = lambda items: unordered_list_comp(items=items)
comp2["ol"] = lambda items: ordered_list_comp(items=items)
xd = flexdown.Flexdown(
block_types=[
DemoOnly,
DemoBlock,
AlertBlock,
DefinitionBlock,
SectionBlock,
VideoBlock,
TabsBlock,
Quot... | comp2["codeblock"] = code_block_markdown_dark |
tab_content.append(block.render(env=env))
except Exception:
print(
f"Error while rendering {type(block)} on line {block.start_line_number}. "
f"\n{block.get_content(env)}"
)
raise
... |
comp2["ol"] = lambda items: ordered_list_comp(items=items)
xd = flexdown.Flexdown(
block_types=[
DemoOnly,
DemoBlock,
AlertBlock,
DefinitionBlock,
SectionBlock,
VideoBlock,
TabsBlock,
QuoteBlock,
],
component_map=component_map,
)
xd.clear_mo... | comp2["ul"] = lambda items: unordered_list_comp(items=items) |
except Exception:
print(
f"Error while rendering {type(block)} on line {block.start_line_number}. "
f"\n{block.get_content(env)}"
)
raise
contents.append(rx.tabs.content(rx.fragment(*tab_content... |
xd = flexdown.Flexdown(
block_types=[
DemoOnly,
DemoBlock,
AlertBlock,
DefinitionBlock,
SectionBlock,
VideoBlock,
TabsBlock,
QuoteBlock,
],
component_map=component_map,
)
xd.clear_modules()
xd2 = flexdown.Flexdown(
block_types=[
... | comp2["ol"] = lambda items: ordered_list_comp(items=items) |
f"Error while rendering {type(block)} on line {block.start_line_number}. "
f"\n{block.get_content(env)}"
)
raise
contents.append(rx.tabs.content(rx.fragment(*tab_content), value=value))
return rx.tabs.root(
rx... |
xd.clear_modules()
xd2 = flexdown.Flexdown(
block_types=[
DemoBlockDark,
AlertBlock,
DefinitionBlock,
SectionBlock,
VideoBlock,
TabsBlock,
QuoteBlock,
],
component_map=comp2,
)
xd2.clear_modules()
def markdown(text):
return xd.get_default_block(... | xd = flexdown.Flexdown(
block_types=[
DemoOnly,
DemoBlock,
AlertBlock,
DefinitionBlock,
SectionBlock,
VideoBlock,
TabsBlock,
QuoteBlock,
],
component_map=component_map,
) |
e=value))
return rx.tabs.root(
rx.tabs.list(*triggers, class_name="mt-4"), *contents, default_value="tab1"
)
component_map = {
"h1": lambda text: h1_comp_xd(text=text),
"h2": lambda text: h2_comp_xd(text=text),
"h3": lambda text: h3_comp_xd(text=text),
"h4": lambda text: h... |
xd2.clear_modules()
def markdown(text):
return xd.get_default_block().render_fn(content=text)
def markdown_codeblock(value: str, **props: object) -> rx.Component:
"""Render a code block using the Shiki-based code block component."""
return rx._x.code_block(value, **props)
def markdown_with_shiki(*arg... | xd2 = flexdown.Flexdown(
block_types=[
DemoBlockDark,
AlertBlock,
DefinitionBlock,
SectionBlock,
VideoBlock,
TabsBlock,
QuoteBlock,
],
component_map=comp2,
) |
,
"h3": lambda text: h3_comp_xd(text=text),
"h4": lambda text: h4_comp_xd(text=text),
"p": lambda text: text_comp(text=text),
"li": lambda text: list_comp(text=text),
"a": doclink2,
"code": lambda text: code_comp(text=text),
"codeblock": code_block_markdown,
}
comp2 = component_map.copy()
co... |
def markdown_codeblock(value: str, **props: object) -> rx.Component:
"""Render a code block using the Shiki-based code block component."""
return rx._x.code_block(value, **props)
def markdown_with_shiki(*args, **kwargs):
"""Wrapper for the markdown component with a customized component map.
Uses th... | def markdown(text):
return xd.get_default_block().render_fn(content=text) |
d(text=text),
"p": lambda text: text_comp(text=text),
"li": lambda text: list_comp(text=text),
"a": doclink2,
"code": lambda text: code_comp(text=text),
"codeblock": code_block_markdown,
}
comp2 = component_map.copy()
comp2["codeblock"] = code_block_markdown_dark
comp2["ul"] = lambda items: unordere... |
def markdown_with_shiki(*args, **kwargs):
"""Wrapper for the markdown component with a customized component map.
Uses the experimental Shiki-based code block (rx._x.code_block)
instead of the default CodeBlock component for code blocks.
Note: This wrapper should be removed once the default codeblock... | def markdown_codeblock(value: str, **props: object) -> rx.Component:
"""Render a code block using the Shiki-based code block component."""
return rx._x.code_block(value, **props) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.