mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
enable console markup (#2122)
* enable console markup * changelog * snapshot
This commit is contained in:
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Changed
|
||||
|
||||
- Textual will now render strings within renderables (such as tables) as Console Markup by default. You can wrap your text with rich.Text() if you want the original behavior. https://github.com/Textualize/textual/issues/2120
|
||||
|
||||
## [0.16.0] - 2023-03-22
|
||||
|
||||
### Added
|
||||
|
||||
@@ -319,7 +319,7 @@ class App(Generic[ReturnType], DOMNode):
|
||||
|
||||
self.console = Console(
|
||||
file=file,
|
||||
markup=False,
|
||||
markup=True,
|
||||
highlight=False,
|
||||
emoji=False,
|
||||
legacy_windows=False,
|
||||
|
||||
File diff suppressed because one or more lines are too long
16
tests/snapshot_tests/snapshot_apps/table_markup.py
Normal file
16
tests/snapshot_tests/snapshot_apps/table_markup.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from textual.app import App, ComposeResult
|
||||
from textual.widgets import Static
|
||||
|
||||
from rich.table import Table
|
||||
|
||||
|
||||
class TableStaticApp(App):
|
||||
def compose(self) -> ComposeResult:
|
||||
table = Table("[i green]Foo", "Bar", "baz")
|
||||
table.add_row("Hello [bold magenta]World!", "[i]Italic", "[u]Underline")
|
||||
yield Static(table)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = TableStaticApp()
|
||||
app.run()
|
||||
@@ -319,3 +319,7 @@ def test_remove_with_auto_height(snap_compare):
|
||||
|
||||
def test_auto_table(snap_compare):
|
||||
assert snap_compare(SNAPSHOT_APPS_DIR / "auto-table.py", terminal_size=(120, 40))
|
||||
|
||||
|
||||
def test_table_markup(snap_compare):
|
||||
assert snap_compare(SNAPSHOT_APPS_DIR / "table_markup.py")
|
||||
|
||||
Reference in New Issue
Block a user