Skip to content

Commit 95ed58a

Browse files
authored
Merge pull request #5734 from Textualize/content-markup
Rename textual markup to content markup
2 parents e6c70b2 + 0e33c53 commit 95ed58a

File tree

8 files changed

+15
-14
lines changed

8 files changed

+15
-14
lines changed

docs/guide/content.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ In this chapter, we will cover all these methods.
1515
When building a custom widget you can embed color and style information in the string returned from the Widget's [`render()`][textual.widget.Widget.render] method.
1616
Markup is specified as a string which contains
1717
Text enclosed in square brackets (`[]`) won't appear in the output, but will modify the style of the text that follows.
18-
This is known as *Textual markup*.
18+
This is known as *content markup*.
1919

20-
Before we explore Textual markup in detail, let's first demonstrate some of what it can do.
20+
Before we explore content markup in detail, let's first demonstrate some of what it can do.
2121
In the following example, we have two widgets.
22-
The top has Textual markup enabled, while the bottom widget has Textual markup *disabled*.
22+
The top has content markup enabled, while the bottom widget has content markup *disabled*.
2323

2424
Notice how the markup *tags* change the style in the first widget, but are left unaltered in the second:
2525

@@ -40,7 +40,7 @@ Notice how the markup *tags* change the style in the first widget, but are left
4040

4141
### Playground
4242

43-
Textual comes with a markup playground where you can enter Textual markup and see the result's live.
43+
Textual comes with a markup playground where you can enter content markup and see the result's live.
4444
To launch the playground, run the following command:
4545

4646
```

docs/guide/widgets.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The highlighted lines define a custom widget class with just a [render()][textua
2828
Textual will display whatever is returned from render in the [content](./content.md) area of your widget.
2929

3030
Note that the text contains tags in square brackets, i.e. `[b]`.
31-
This is [Textual markup](./content.md#markup) which allows you to embed various styles within your content.
31+
This is [content markup](./content.md#markup) which allows you to embed various styles within your content.
3232
If you run this you will find that `World` is in bold.
3333

3434
```{.textual path="docs/examples/guide/widgets/hello01.py"}

src/textual/content.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def __str__(self) -> str:
145145

146146
@cached_property
147147
def markup(self) -> str:
148-
"""Get Textual markup to render this Text.
148+
"""Get content markup to render this Text.
149149
150150
Returns:
151151
str: A string potentially creating markup tags.
@@ -215,7 +215,7 @@ def from_text(
215215

216216
@classmethod
217217
def from_markup(cls, markup: str | Content, **variables: object) -> Content:
218-
"""Create content from Textual markup, optionally combined with template variables.
218+
"""Create content from markup, optionally combined with template variables.
219219
220220
If `markup` is already a Content instance, it will be returned unmodified.
221221
@@ -228,7 +228,7 @@ def from_markup(cls, markup: str | Content, **variables: object) -> Content:
228228
```
229229
230230
Args:
231-
markup: Textual markup, or Content.
231+
markup: Content markup, or Content.
232232
**variables: Optional template variables used
233233
234234
Returns:

src/textual/markup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828

2929
class MarkupError(Exception):
30-
"""An error occurred parsing Textual markup."""
30+
"""An error occurred parsing content markup."""
3131

3232

3333
expect_markup_tag = (
@@ -73,7 +73,7 @@ class MarkupError(Exception):
7373

7474

7575
class MarkupTokenizer(TokenizerState):
76-
"""Tokenizes Textual markup."""
76+
"""Tokenizes content markup."""
7777

7878
EXPECT = expect_markup.expect_eof()
7979
STATE_MAP = {

src/textual/notifications.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Notification:
4040
"""The timeout (in seconds) for the notification."""
4141

4242
markup: bool = False
43-
"""Render the notification message as Textual Markup?"""
43+
"""Render the notification message as content markup?"""
4444

4545
raised_at: float = field(default_factory=time)
4646
"""The time when the notification was raised (in Unix time)."""

src/textual/widget.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ def __init__(
410410
id: The ID of the widget in the DOM.
411411
classes: The CSS classes for the widget.
412412
disabled: Whether the widget is disabled or not.
413+
markup: Enable content markup?
413414
"""
414415
self._render_markup = markup
415416
_null_size = NULL_SIZE
@@ -4618,7 +4619,7 @@ def notify(
46184619
title: The title for the notification.
46194620
severity: The severity of the notification.
46204621
timeout: The timeout (in seconds) for the notification, or `None` for default.
4621-
markup: Render the message as Textual markup?
4622+
markup: Render the message as content markup?
46224623
46234624
See [`App.notify`][textual.app.App.notify] for the full
46244625
documentation for this method.

src/textual/widgets/_option_list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def __init__(
261261
id: The ID of the OptionList in the DOM.
262262
classes: Initial CSS classes.
263263
disabled: Disable the widget?
264-
markup: Strips should be rendered as Textual markup if `True`, or plain text if `False`.
264+
markup: Strips should be rendered as content markup if `True`, or plain text if `False`.
265265
"""
266266
super().__init__(name=name, id=id, classes=classes, disabled=disabled)
267267
self._markup = markup

tests/test_content.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def test_add() -> None:
136136

137137

138138
def test_from_markup():
139-
"""Test simple parsing of Textual markup."""
139+
"""Test simple parsing of content markup."""
140140
content = Content.from_markup("[red]Hello[/red] [blue]World[/blue]")
141141
assert len(content) == 11
142142
assert content.plain == "Hello World"

0 commit comments

Comments
 (0)