Skip to content

Commit 482ec96

Browse files
committed
improve docs clarity
1 parent 9b36b6d commit 482ec96

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed

docs/src/reference/components.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ This allows you to embedded any number of client-side PyScript components within
1414

1515
{% include-markdown "../reference/template-tag.md" start="<!--pyscript-def-start-->" end="<!--pyscript-def-end-->" %}
1616

17+
{% include-markdown "../reference/template-tag.md" start="<!--pyscript-raw-text-start-->" end="<!--pyscript-raw-text-end-->" %}
18+
1719
=== "components.py"
1820

1921
```python

docs/src/reference/decorators.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Decorator functions can be used within your `components.py` to help simplify dev
1212

1313
You can limit component access to users that pass a test function by using this decorator.
1414

15-
This decorator is inspired by Django's [`user_passes_test`](http://docs.djangoproject.com/en/dev/topics/auth/default/#django.contrib.auth.decorators.user_passes_test) decorator, but works with ReactPy components.
15+
This decorator is inspired by Django's [`user_passes_test`](http://docs.djangoproject.com/en/dev/topics/auth/default/#django.contrib.auth.decorators.user_passes_test) decorator, but this one works with ReactPy components.
1616

1717
=== "components.py"
1818

docs/src/reference/hooks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ This is often used to create chat systems, synchronize data between components,
400400

401401
In these cases, you can use the `#!python use_channel_layer` hook to receive a signal within your component, and then use the `#!python get_channel_layer().send(...)` to send the signal.
402402

403-
In the example below, the sender will send a signal every time `#!python ExampleModel` is saved. Then, when the receiver component gets this signal, it explicitly calls `#!python set_message(...)` to trigger a re-render.
403+
In the example below, the sender will signal every time `#!python ExampleModel` is saved. Then, when the receiver gets this signal, it explicitly calls `#!python set_message(...)` to trigger a re-render.
404404

405405
=== "signals.py"
406406

@@ -522,7 +522,7 @@ You can expect this hook to provide strings such as `http://example.com`.
522522

523523
Shortcut that returns the root component's `#!python id` from the WebSocket or HTTP connection.
524524

525-
The root ID is currently a randomly generated `#!python uuid4` (unique across all root component).
525+
The root ID is a randomly generated `#!python uuid4`. It is noteable to mention that it is persistent across the current connection. The `uuid` is reset when the page is refreshed.
526526

527527
This is useful when used in combination with [`#!python use_channel_layer`](#use-channel-layer) to send messages to a specific component instance, and/or retain a backlog of messages in case that component is disconnected via `#!python use_channel_layer( ... , group_discard=False)`.
528528

docs/src/reference/html.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ We supply some pre-generated that HTML nodes can be used to help simplify develo
1010

1111
## PyScript
1212

13-
Primitive HTML tag that is leveraged by [`reactpy_django.components.pyscript_component`](./components.md#pyscript-component).
13+
PyScript code block. The text content of this tag are executed within the PyScript interpreter. This can be used as an alternative to the `#!python reactpy.html.script`.
1414

15-
This can be used as an alternative to the `#!python reactpy.html.script` tag to execute JavaScript and run client-side Python code.
15+
This is a primitive HTML tag that is leveraged by [`reactpy_django.components.pyscript_component`](./components.md#pyscript-component).
1616

17-
Additionally, this tag functions identically to any other tag contained within `#!python reactpy.html`, and can be used in the same way.
17+
The `pyscript` tag functions identically to HTML tags contained within `#!python reactpy.html`.
1818

1919
=== "components.py"
2020

docs/src/reference/template-tag.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Django template tags can be used within your HTML templates to provide ReactPy f
1010

1111
## Component
1212

13-
This template tag can be used to insert any number of ReactPy components onto your page.
13+
This template tag can be used to insert any number of **server-side** ReactPy components onto your page.
1414

1515
Each component loaded via this template tag will receive a dedicated WebSocket connection to the server.
1616

@@ -159,16 +159,19 @@ This template tag can be used to insert any number of **client-side** ReactPy co
159159

160160
By default, the only dependencies available are the Python standard library, `pyscript`, `pyodide`, `reactpy` core.
161161

162-
Your PyScript component file requires a `#!python def root()` component to function as the entry point.
162+
The entire file path provided is loaded directly into the browser, and must have a `#!python def root()` component to act as the entry point.
163163

164164
<!--pyscript-def-end-->
165+
<!--pyscript-raw-text-start-->
165166

166167
!!! warning "Pitfall"
167168

168169
Your provided Python file is loaded directly into the client (web browser) **as raw text**, and ran using a PyScript interpreter. Be cautious about what you include in your Python file.
169170

170171
As a result of running client-side, Python packages within your local environment (such as those installed via `pip install ...`) are **not accessible** within PyScript components.
171172

173+
<!--pyscript-raw-text-end-->
174+
172175
=== "my_template.html"
173176

174177
```jinja

docs/src/reference/utils.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Utility functions provide various miscellaneous functionality for advanced use c
1414

1515
## Register Iframe
1616

17-
This function is used register a view as an `#!python iframe` with ReactPy.
17+
This function is used register a Django view as a ReactPy `#!python iframe`.
1818

1919
It is mandatory to use this function alongside [`view_to_iframe`](../reference/components.md#view-to-iframe).
2020

0 commit comments

Comments
 (0)