Skip to content
This repository was archived by the owner on Apr 28, 2026. It is now read-only.

Commit febece9

Browse files
committed
Updates for react-markdown 10.0.0 and associated reflex changes
1 parent 756e024 commit febece9

3 files changed

Lines changed: 13 additions & 13 deletions

File tree

docs/library/typography/markdown.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Each key in the `component_map` prop is a markdown element, and the value is
7373
a function that takes the text of the element as input and returns a Reflex component.
7474

7575
```md alert
76-
The `codeblock` and `a` tags are special cases. In addition to the `text`, they also receive a `props` argument containing additional props for the component.
76+
The `pre` and `a` tags are special cases. In addition to the `text`, they also receive a `props` argument containing additional props for the component.
7777
```
7878

7979
```python demo exec
@@ -83,7 +83,7 @@ component_map = {
8383
"h3": lambda text: rx.heading(text, size="1", margin_y="1em"),
8484
"p": lambda text: rx.text(text, color="green", margin_y="1em"),
8585
"code": lambda text: rx.code(text, color="purple"),
86-
"codeblock": lambda text, **props: rx.code_block(text, **props, theme=rx.code_block.themes.dark, margin_y="1em"),
86+
"pre": lambda text, **props: rx.code_block(text, **props, theme=rx.code_block.themes.dark, margin_y="1em"),
8787
"a": lambda text, **props: rx.link(text, **props, color="blue", _hover={"color": "red"}),
8888
}
8989

pcweb/flexdown.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -602,11 +602,11 @@ def render(self, env) -> rx.Component:
602602
"li": lambda text: list_comp(text=text),
603603
"a": doclink2,
604604
"code": lambda text: code_comp(text=text),
605-
"codeblock": code_block_markdown,
605+
"pre": code_block_markdown,
606606
"img": lambda src: img_comp_xd(src=src),
607607
}
608608
comp2 = component_map.copy()
609-
comp2["codeblock"] = code_block_markdown_dark
609+
comp2["pre"] = code_block_markdown_dark
610610
comp2["ul"] = lambda items: unordered_list_comp(items=items)
611611
comp2["ol"] = lambda items: ordered_list_comp(items=items)
612612

@@ -659,6 +659,6 @@ def markdown_with_shiki(*args, **kwargs):
659659
"""
660660
return rx.markdown(
661661
*args,
662-
component_map={"codeblock": markdown_codeblock},
662+
component_map={"pre": markdown_codeblock},
663663
**kwargs,
664664
)

pcweb/templates/docpage/blocks/headings.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ def h1_comp(text: str) -> rx.Component:
5252

5353

5454
@rx.memo
55-
def h1_comp_xd(text: list[str]) -> rx.Component:
55+
def h1_comp_xd(text: str) -> rx.Component:
5656
return h_comp_common(
57-
text=text[0],
57+
text=text,
5858
heading="h1",
5959
class_name="font-x-large lg:font-xx-large",
6060
)
@@ -71,9 +71,9 @@ def h2_comp(text: str) -> rx.Component:
7171

7272

7373
@rx.memo
74-
def h2_comp_xd(text: list[str]) -> rx.Component:
74+
def h2_comp_xd(text: str) -> rx.Component:
7575
return h_comp_common(
76-
text=text[0],
76+
text=text,
7777
heading="h2",
7878
mt="8",
7979
class_name="font-large lg:font-x-large",
@@ -91,9 +91,9 @@ def h3_comp(text: str) -> rx.Component:
9191

9292

9393
@rx.memo
94-
def h3_comp_xd(text: list[str]) -> rx.Component:
94+
def h3_comp_xd(text: str) -> rx.Component:
9595
return h_comp_common(
96-
text=text[0],
96+
text=text,
9797
heading="h3",
9898
mt="4",
9999
class_name="font-large",
@@ -111,9 +111,9 @@ def h4_comp(text: str) -> rx.Component:
111111

112112

113113
@rx.memo
114-
def h4_comp_xd(text: list[str]) -> rx.Component:
114+
def h4_comp_xd(text: str) -> rx.Component:
115115
return h_comp_common(
116-
text=text[0],
116+
text=text,
117117
heading="h4",
118118
mt="2",
119119
class_name="font-md-smbold",

0 commit comments

Comments
 (0)