You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 28, 2026. It is now read-only.
* Updates for react-markdown 10.0.0 and associated reflex changes
* Update markdown docs with info on plugins
* fix misrendered nested code blocks in markdown examples
* update deps
* update pyproject.toml
* Robust slugify of markdown header data
You can now include nested markdown in headers and it will slugify it correctly
using hast-util-to-string to properly extract recursively nested elements.
Also includes a driveby fix for scroll-margin when the hosting banner is
displayed.
You can render code blocks with syntax highlighting using the \`\`\`\{language} syntax:
37
37
38
-
```python demo
38
+
````python demo
39
39
rx.markdown(
40
40
r"""
41
-
\```python
41
+
```python
42
42
import reflex as rx
43
43
from .pages import index
44
44
45
45
app = rx.App()
46
46
app.add_page(index)
47
-
\```
47
+
```
48
48
"""
49
49
)
50
-
```
50
+
````
51
51
52
52
## Tables
53
53
@@ -64,6 +64,86 @@ rx.markdown(
64
64
)
65
65
```
66
66
67
+
## Plugins
68
+
69
+
Plugins can be used to extend the functionality of the markdown renderer.
70
+
71
+
By default Reflex uses the following plugins:
72
+
-`remark-gfm` for Github Flavored Markdown support (`use_gfm`).
73
+
-`remark-math` and `rehype-katex` for math equation support (`use_math`, `use_katex`).
74
+
-`rehype-unwrap-images` to remove paragraph tags around images (`use_unwrap_images`).
75
+
-`rehype-raw` to render raw HTML in markdown (`use_raw`). NOTE: in a future release this will be disabled by default for security reasons.
76
+
77
+
These default plugins can be disabled by passing `use_[plugin_name]=False` to the `rx.markdown` component. For example, to disable raw HTML rendering, use `rx.markdown(..., use_raw=False)`.
78
+
79
+
## Arbitrary Plugins
80
+
81
+
You can also add arbitrary remark or rehype plugins using the `remark_plugins`
82
+
and `rehype_plugins` props in conjunction with the `rx.markdown.plugin` helper.
83
+
84
+
`rx.markdown.plugin` takes two arguments:
85
+
86
+
1. The npm package name and version of the plugin (e.g. `remark-emoji@5.0.2`).
87
+
2. The named export to use from the plugin (e.g. `remarkEmoji`).
88
+
89
+
### Remark Plugin Example
90
+
91
+
For example, to add support for emojis using the `remark-emoji` plugin:
You can specify which components to use for rendering markdown elements using the
@@ -73,17 +153,17 @@ Each key in the `component_map` prop is a markdown element, and the value is
73
153
a function that takes the text of the element as input and returns a Reflex component.
74
154
75
155
```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.
156
+
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.
0 commit comments