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
Copy file name to clipboardExpand all lines: docs/guide/content.md
+22Lines changed: 22 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -312,6 +312,28 @@ Here's what that looks like:
312
312
```{.textual path="docs/examples/guide/content/playground.py" lines=16 type="Play the [on $success 30% @click=app.bell]bell[/]"]}
313
313
```
314
314
315
+
### Escaping
316
+
317
+
If you precede an open bracket with a backslash (`\`), then Textual will not consider it to be a tag and the square bracket will be displayed without modification.
318
+
319
+
For example, the backslash in the following content prevents the following text from becoming bold, and the text `[bold]` will be in the output.
320
+
321
+
```{.textual path="docs/examples/guide/content/playground.py" lines=16 type="\[bold]This is not bold"]}
322
+
```
323
+
324
+
!!! tip "Escaping markup"
325
+
326
+
You can also use the [escape][textual.markup.escape] function to escape tags
327
+
328
+
Some methods, such as [`notify()`][textual.widget.Widget.notify], have a `markup` switch that you can use to disable markup.
329
+
You may want to use this if you want to output a Python repr strings, so that Textual doesn't interpret a list as a tag.
0 commit comments