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
Fix code block rendering inconsistencies and update page title on custom components command reference (#1491)
* Fix code block rendering inconsistencies and update page title
- Standardize all code blocks to use consistent markdown formatting
- Replace doccmdoutput() calls with standard bash/text code blocks
- Remove python exec imports that are no longer needed
- Update page title to 'Custom Component CLI Reference' for clarity
- Fix visual inconsistencies between different code block types
Co-Authored-By: unknown <>
* Fix empty code blocks by adding text language specification
- Add 'text' language specification to all output code blocks
- Fixes rendering issue where plain code blocks appeared empty
- Ensures consistent code block styling throughout the page
Co-Authored-By: unknown <>
* Fix folder structure code block by adding text language specification
Co-Authored-By: unknown <>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/custom-components/command-reference.md
+26-44Lines changed: 26 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,20 +1,13 @@
1
1
# Command Reference
2
2
3
-
```python exec
4
-
import reflex as rx
5
-
from pcweb.pages.docs import wrapping_react
6
-
from pcweb.pages.gallery import gallery
7
-
from pcweb.pages.docs import custom_components
8
-
from pcweb.templates.docpage import doccmdoutput
9
-
from pcweb.styles.fonts import code
10
-
```
11
-
12
3
The custom component commands are under `reflex component` subcommand. To see the list of available commands, run `reflex component --help`. To see the manual on a specific command, run `reflex component <command> --help`, for example, `reflex component init --help`.
[ pyproject.toml ]: Project configuration file. Please fill in details such as your name, email, homepage URL.
52
47
[ custom_components/ ]: Custom component code template. Start by editing it with your component implementation.
53
48
[ google_auth_demo/ ]: Demo App. Add more code to this app and test.
54
-
""",
55
-
)
56
49
```
57
50
58
51
The `init` command uses the current enclosing folder name to construct a python package name, typically in the kebab case. For example, if running init in folder `google_auth`, the package name will be `reflex-google-auth`. The added prefix reduces the chance of name collision on PyPI (the Python Package Index), and it indicates that the package is a Reflex custom component. The user can override the package name by providing the `--package-name` option.
59
52
60
53
The `init` command creates a set of files and folders prefilled with the package name and other details. During the init, the `custom_component` folder is installed locally in editable mode, so a developer can incrementally develop and test with ease. The changes in component implementation is automatically reflected where it is used. Below is the folder structure after the `init` command.
61
54
62
-
```python eval
63
-
rx._x.code_block("""
55
+
```text
64
56
google_auth/
65
57
├── pyproject.toml
66
58
├── README.md
@@ -73,17 +65,6 @@ google_auth/
73
65
google_auth_demo/
74
66
requirements.txt
75
67
rxconfig.py
76
-
""",
77
-
language="bash",
78
-
style={
79
-
"border-radius": "12px",
80
-
"border": "1px solid var(--c-slate-4)",
81
-
"background": "var(--c-slate-2)",
82
-
"color": "var(--c-slate-12)",
83
-
"font-family": "Source Code Pro",
84
-
**code
85
-
}
86
-
)
87
68
```
88
69
89
70
### pyproject.toml
@@ -110,10 +91,12 @@ A demo app is generated inside `google_auth_demo` folder with import statements
110
91
111
92
The help manual is shown when adding the `--help` option to the command.
112
93
113
-
```python eval
114
-
doccmdoutput(
115
-
command="reflex component init --help",
116
-
output="""Usage: reflex component init [OPTIONS]
94
+
```bash
95
+
reflex component init --help
96
+
```
97
+
98
+
```text
99
+
Usage: reflex component init [OPTIONS]
117
100
118
101
Initialize a custom component.
119
102
@@ -134,7 +117,6 @@ Options:
134
117
The log level to use. [default:
135
118
LogLevel.INFO]
136
119
--help Show this message and exit.
137
-
""")
138
120
```
139
121
140
122
## reflex component publish
@@ -149,10 +131,11 @@ It is not required to run the `build` command separately before publishing. The
149
131
150
132
The `build` command generates the `.tar.gz` and `.whl` distribution files to be uploaded to the desired package index, for example, PyPI. This command must be run at the top level of the project where the `pyproject.toml` file is. As a result of a successful build, there is a new `dist` folder with the distribution files.
151
133
152
-
```python eval
153
-
doccmdoutput(
154
-
command="reflex component build --help",
155
-
output="""reflex component build --help
134
+
```bash
135
+
reflex component build --help
136
+
```
137
+
138
+
```text
156
139
Usage: reflex component build [OPTIONS]
157
140
158
141
Build a custom component. Must be run from the project root directory where
0 commit comments