Skip to content

Commit 991928b

Browse files
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>
1 parent 8132759 commit 991928b

File tree

2 files changed

+27
-44
lines changed

2 files changed

+27
-44
lines changed

docs/custom-components/command-reference.md

Lines changed: 26 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
# Command Reference
22

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-
123
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`.
134

14-
```python eval
15-
doccmdoutput(
16-
command="reflex component --help",
17-
output="""Usage: reflex component [OPTIONS] COMMAND [ARGS]...
5+
```bash
6+
reflex component --help
7+
```
8+
9+
```text
10+
Usage: reflex component [OPTIONS] COMMAND [ARGS]...
1811
1912
Subcommands for creating and publishing Custom Components.
2013
@@ -24,17 +17,19 @@ Options:
2417
Commands:
2518
init Initialize a custom component.
2619
build Build a custom component.
27-
share Collect more details on the published package for gallery.""")
20+
share Collect more details on the published package for gallery.
2821
```
2922

3023
## reflex component init
3124

3225
Below is an example of running the `init` command.
3326

34-
```python eval
35-
doccmdoutput(
36-
command="reflex component init",
37-
output="""reflex component init
27+
```bash
28+
reflex component init
29+
```
30+
31+
```text
32+
reflex component init
3833
─────────────────────────────────────── Initializing reflex-google-auth project ───────────────────────────────────────
3934
Info: Populating pyproject.toml with package name: reflex-google-auth
4035
Info: Initializing the component directory: custom_components/reflex_google_auth
@@ -51,16 +46,13 @@ Custom component initialized successfully!
5146
[ pyproject.toml ]: Project configuration file. Please fill in details such as your name, email, homepage URL.
5247
[ custom_components/ ]: Custom component code template. Start by editing it with your component implementation.
5348
[ google_auth_demo/ ]: Demo App. Add more code to this app and test.
54-
""",
55-
)
5649
```
5750

5851
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.
5952

6053
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.
6154

62-
```python eval
63-
rx._x.code_block("""
55+
```text
6456
google_auth/
6557
├── pyproject.toml
6658
├── README.md
@@ -73,17 +65,6 @@ google_auth/
7365
google_auth_demo/
7466
requirements.txt
7567
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-
)
8768
```
8869

8970
### pyproject.toml
@@ -110,10 +91,12 @@ A demo app is generated inside `google_auth_demo` folder with import statements
11091

11192
The help manual is shown when adding the `--help` option to the command.
11293

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]
117100
118101
Initialize a custom component.
119102
@@ -134,7 +117,6 @@ Options:
134117
The log level to use. [default:
135118
LogLevel.INFO]
136119
--help Show this message and exit.
137-
""")
138120
```
139121

140122
## reflex component publish
@@ -149,10 +131,11 @@ It is not required to run the `build` command separately before publishing. The
149131

150132
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.
151133

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
156139
Usage: reflex component build [OPTIONS]
157140
158141
Build a custom component. Must be run from the project root directory where
@@ -167,5 +150,4 @@ Options:
167150
The log level to use. [default:
168151
LogLevel.INFO]
169152
--help Show this message and exit.
170-
""")
171-
```
153+
```

pcweb/pages/docs/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ def exec_blocks(doc, href):
120120
manual_titles = {
121121
"docs/database/overview.md": "Database Overview",
122122
"docs/custom-components/overview.md": "Custom Components Overview",
123+
"docs/custom-components/command-reference.md": "Custom Component CLI Reference",
123124
"docs/api-routes/overview.md": "API Routes Overview",
124125
"docs/client_storage/overview.md": "Client Storage Overview",
125126
"docs/state_structure/overview.md": "State Structure Overview",

0 commit comments

Comments
 (0)