From 92bb83ab7ac313364a5276573c4156ca817f1440 Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Thu, 27 Apr 2023 11:30:16 +0100 Subject: [PATCH] :sparkles: Test code for https://github.com/Textualize/textual/issues/2400 --- md_code_blocks.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 md_code_blocks.py diff --git a/md_code_blocks.py b/md_code_blocks.py new file mode 100644 index 0000000..90fbd30 --- /dev/null +++ b/md_code_blocks.py @@ -0,0 +1,36 @@ +"""https://github.com/Textualize/textual/issues/2400""" + +from textual.app import App, ComposeResult +from textual.containers import VerticalScroll +from textual.widgets import Header, Footer, Markdown + +MARKDOWN = """\ +# Hello world! + +Here is some Python code in a code block: + +```python +def hello() -> str: + return "Hello!" +``` + +Here is some plain text in a code block: + +``` +Hello! +``` + +""" +class MDCodeBlocksApp( App[ None ] ): + + def compose( self ) -> ComposeResult: + yield Header() + with VerticalScroll(): + yield Markdown( MARKDOWN ) + yield Footer() + + def on_mount( self ) -> None: + self.dark = True + +if __name__ == "__main__": + MDCodeBlocksApp().run()