-
-
Notifications
You must be signed in to change notification settings - Fork 993
Closed
Description
Running into an issue where the MarkdownTableContent DEFAULT_CSS is causing a crash when I try to run my app which is using the Markdown widget as a parent. Here is an excerpt of example code causing the issue:
test_text = """
[Other markdown here]
---
| Column 1 | Column 2 | Column 3 |
|----------|----------|----------|
| Cell A | Cell B | Cell C |
| **Bold** | *Italic* | `Code` |
---
"""
class ChatBubble(Markdown): # unfinished subclass
def __init__(self, markdown:str)-> None:
super().__init__(markdown)
class AgentBubble(ChatBubble):
def __init__(self, spaced_markdown: str) -> None:
markdown = textwrap.dedent(spaced_markdown).strip()
super().__init__(markdown)
self.border_title = 'Agent'
self.styles.border_title_align = 'left'
# within later parent widget class
def on_mount(self) -> None:
if self.screen.initial_mount: # type: ignore
self.screen.initial_mount = True # type: ignore
chat_region = self.query_one('#chat_region')
if stack := rl_handler.stash:
while len(stack) > 0:
record = stack.pop()
chat_region.mount(ConsoleBubble(record))
chat_region.mount(AgentBubble(test_text)) # for live CSS dev
❯ uv run miwa.py
╭─ Error at /home/ccos/code/miwa/.venv/lib/python3.13/site-packages/textual/widgets/_markd─╮
│ 22 │ │ │ content-align: left bottom; │
│ 23 │ │ } │
│ ❱ 24 │ │ keyline: thin $foreground 20%; │
│ 25 │ } │
│ 26 │ MarkdownTableContent > .markdown-table--header { │
╰──────────────────────────────────────────────────────────────────────────────────────────╯
Invalid value for keyline property
├── The keyline property expects exactly 2 values
│ e.g. keyline: <type> <color>
└── Valid values for <type> are 'double', 'heavy', 'none', or 'thin'
CSS parsing failed: 1 error found in stylesheet
Editing the _markdown.py file and the offending line to be just keyline: thin $foreground
fixes the crash, but I'm not sure why this is happening if it is something on my end. I am not doing anything crazy at the App level regarding the CSS:
class Miwa(App):
def __init__(self) -> None:
super().__init__( css_path='./miwa.tcss', watch_css=True)
# rest of app
Versions
Name | Value |
---|---|
Textual | 5.3.0 |
Rich | 14.1.0 |
Python
Name | Value |
---|---|
Version | 3.13.7 |
Implementation | CPython |
Compiler | GCC 15.2.1 20250813 |
Executable | /home/ccos/code/miwa/.venv/bin/python3 |
Operating System
Name | Value |
---|---|
System | Linux |
Release | 6.6.87.2-microsoft-standard-WSL2 |
Version | #1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025 |
Terminal
Name | Value |
---|---|
Terminal Application | tmux (next-3.6) |
TERM | tmux-256color |
COLORTERM | Not set |
FORCE_COLOR | Not set |
NO_COLOR | Not set |
Rich Console options
Name | Value |
---|---|
size | width=92, height=39 |
legacy_windows | False |
min_width | 1 |
max_width | 92 |
is_terminal | True |
encoding | utf-8 |
max_height | 39 |
justify | None |
overflow | None |
no_wrap | False |
highlight | None |
markup | None |
height | None |
Thanks in advance and sorry if I'm doing something dumb.
Metadata
Metadata
Assignees
Labels
No labels