Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tweak to Markdown #4541

Merged
merged 4 commits into from
May 22, 2024
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Fixed

- Fixed actions in links
- Fixed actions in links https://github.com/Textualize/textual/pull/4540

### Changed

- Breaking change: New Footer (likely a drop in replacement, unless you have customized styles) https://github.com/Textualize/textual/pull/4537
- Stylistic changes to Markdown (simpler headers, less margin, etc) https://github.com/Textualize/textual/pull/4541

## [0.62.0] - 2024-05-20

Expand Down
2 changes: 1 addition & 1 deletion src/textual/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def _get_unicode_name_from_key(key: str) -> str:

This function can be seen as a pseudo-inverse of the function `_character_to_key`.
"""
return KEY_TO_UNICODE_NAME.get(key, key.upper())
return KEY_TO_UNICODE_NAME.get(key, key)


def _get_key_aliases(key: str) -> list[str]:
Expand Down
52 changes: 29 additions & 23 deletions src/textual/widgets/_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ class MarkdownHeader(MarkdownBlock):
DEFAULT_CSS = """
MarkdownHeader {
color: $text;
margin: 2 0 1 0;

}
"""

Expand All @@ -241,13 +243,10 @@ class MarkdownH1(MarkdownHeader):
DEFAULT_CSS = """

MarkdownH1 {
background: $accent-darken-2;
border: wide $background;
content-align: center middle;

padding: 1;
content-align: center middle;
text-style: bold;
color: $text;
color: $success;
&:light {color: $primary;}
}
"""

Expand All @@ -258,13 +257,10 @@ class MarkdownH2(MarkdownHeader):
DEFAULT_CSS = """

MarkdownH2 {
background: $panel;
border: wide $background;
text-align: center;
text-style: underline;
color: $text;
padding: 1;
text-style: bold;
color: $success;
&:light {color: $primary;}

}
"""

Expand All @@ -274,10 +270,11 @@ class MarkdownH3(MarkdownHeader):

DEFAULT_CSS = """
MarkdownH3 {
background: $surface;

text-style: bold;
color: $text;
border-bottom: wide $foreground;
color: $success;
&:light {color: $primary;}
margin: 1 0;
width: auto;
}
"""
Expand All @@ -288,8 +285,9 @@ class MarkdownH4(MarkdownHeader):

DEFAULT_CSS = """
MarkdownH4 {
text-style: underline;
text-style: bold underline;
margin: 1 0;
color: $text;
}
"""

Expand All @@ -302,6 +300,7 @@ class MarkdownH5(MarkdownHeader):
text-style: bold;
color: $text;
margin: 1 0;

}
"""

Expand Down Expand Up @@ -348,10 +347,13 @@ class MarkdownBlockQuote(MarkdownBlock):
DEFAULT_CSS = """
MarkdownBlockQuote {
background: $boost;
border-left: outer $success;
border-left: outer $success-darken-2;
margin: 1 0;
padding: 0 1;
}
MarkdownBlockQuote:light {
border-left: outer $primary;
}
MarkdownBlockQuote > BlockQuote {
margin-left: 2;
margin-top: 1;
Expand Down Expand Up @@ -491,10 +493,8 @@ class MarkdownTable(MarkdownBlock):

DEFAULT_CSS = """
MarkdownTable {
width: 100%;
margin: 1 0;
background: $panel;
border: wide $background;
width: 100%;
background: $panel;
}
"""

Expand Down Expand Up @@ -547,6 +547,9 @@ class MarkdownBullet(Widget):
width: auto;
color: $success;
text-style: bold;
&:light {
color: $primary;
}
}
"""

Expand Down Expand Up @@ -594,9 +597,11 @@ class MarkdownFence(MarkdownBlock):
margin: 1 0;
overflow: auto;
width: 100%;
height: auto;
height: auto;
max-height: 20;
color: rgb(210,210,210);


}

MarkdownFence > * {
Expand Down Expand Up @@ -661,8 +666,9 @@ class Markdown(Widget):
DEFAULT_CSS = """
Markdown {
height: auto;
margin: 0 4 1 4;
margin: 0 2 1 2;
layout: vertical;
color: $text;
}
.em {
text-style: italic;
Expand Down
Loading
Loading