Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Improved rendering of Markdown tables (replace Rich table with grid) which allows text selection https://github.com/Textualize/textual/pull/5962
- Change look of command palette, to drop accented borders https://github.com/Textualize/textual/pull/5966

### Removed

- Breaking change: Removed `Markdown.code_dark_theme`, `Markdown.code_light_theme`, `Markdown.code_indent_guides` which are no longer needed with the new code fence. https://github.com/Textualize/textual/pull/5967

## [4.0.0] - 2025-07-12

### Fixed
Expand Down
30 changes: 1 addition & 29 deletions src/textual/widgets/_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -802,11 +802,6 @@ def __init__(self, markdown: Markdown, code: str, lexer: str) -> None:
super().__init__(markdown)
self.code = code
self.lexer = lexer
self.theme = (
self._markdown.code_dark_theme
if self.app.current_theme.dark
else self._markdown.code_light_theme
)
code_content = highlight(self.code, language=lexer)
self.set_content(code_content)

Expand Down Expand Up @@ -872,15 +867,6 @@ class Markdown(Widget):

BULLETS = ["\u25cf ", "▪ ", "‣ ", "• ", "⭑ "]

code_dark_theme: reactive[str] = reactive("material")
"""The theme to use for code blocks when the App theme is dark."""

code_light_theme: reactive[str] = reactive("material-light")
"""The theme to use for code blocks when the App theme is light."""

code_indent_guides: reactive[bool] = reactive(True)
"""Should code fences display indent guides?"""

def __init__(
self,
markdown: str | None = None,
Expand Down Expand Up @@ -1033,18 +1019,6 @@ def on_markdown_link_clicked(self, event: LinkClicked) -> None:
if self._open_links:
self.app.open_url(event.href)

def _watch_code_dark_theme(self) -> None:
"""React to the dark theme being changed."""
if self.app.current_theme.dark:
for block in self.query(MarkdownFence):
block._retheme()

def _watch_code_light_theme(self) -> None:
"""React to the light theme being changed."""
if not self.app.current_theme.dark:
for block in self.query(MarkdownFence):
block._retheme()

@staticmethod
def sanitize_location(location: str) -> tuple[Path, str]:
"""Given a location, break out the path and any anchor.
Expand Down Expand Up @@ -1436,8 +1410,6 @@ class MarkdownViewer(VerticalScroll, can_focus=False, can_focus_children=True):

show_table_of_contents = reactive(True)
"""Show the table of contents?"""
code_indent_guides: reactive[bool] = reactive(True)
"""Should code fences display indent guides?"""
top_block = reactive("")

navigator: var[Navigator] = var(Navigator)
Expand Down Expand Up @@ -1521,7 +1493,7 @@ def compose(self) -> ComposeResult:
parser_factory=self._parser_factory, open_links=self._open_links
)
markdown.can_focus = True
yield markdown.data_bind(MarkdownViewer.code_indent_guides)
yield markdown
yield MarkdownTableOfContents(markdown)

def _on_markdown_table_of_contents_updated(
Expand Down
Loading