summaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorA-Walrus2023-09-25 15:42:42 +0000
committerGitHub2023-09-25 15:42:42 +0000
commitf520b16fcaa2bc13d8d72c09694d88717055d0fd (patch)
treee551dde2ad5ee06cfe43f8bdeed46ef8ddb83b1e /helix-term
parent0252c7b162ae5f3ff18b03ed9fe947d61a301926 (diff)
Style Bold/Italic/Strikethrough markdown in docs (#8385)
* Style Bold/Italic/Strikthrough markdown in docs * Flatten to single match
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/ui/markdown.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/helix-term/src/ui/markdown.rs b/helix-term/src/ui/markdown.rs
index 1433381d..3c8a9868 100644
--- a/helix-term/src/ui/markdown.rs
+++ b/helix-term/src/ui/markdown.rs
@@ -14,6 +14,7 @@ use helix_core::{
};
use helix_view::{
graphics::{Margin, Rect, Style},
+ theme::Modifier,
Theme,
};
@@ -275,17 +276,21 @@ impl Markdown {
);
lines.extend(tui_text.lines.into_iter());
} else {
- let style = if let Some(Tag::Heading(level, ..)) = tags.last() {
- match level {
+ let style = match tags.last() {
+ Some(Tag::Heading(level, ..)) => match level {
HeadingLevel::H1 => heading_styles[0],
HeadingLevel::H2 => heading_styles[1],
HeadingLevel::H3 => heading_styles[2],
HeadingLevel::H4 => heading_styles[3],
HeadingLevel::H5 => heading_styles[4],
HeadingLevel::H6 => heading_styles[5],
+ },
+ Some(Tag::Emphasis) => text_style.add_modifier(Modifier::ITALIC),
+ Some(Tag::Strong) => text_style.add_modifier(Modifier::BOLD),
+ Some(Tag::Strikethrough) => {
+ text_style.add_modifier(Modifier::CROSSED_OUT)
}
- } else {
- text_style
+ _ => text_style,
};
spans.push(Span::styled(text, style));
}