Support rendering strikethrough text in markdown (#8287)
Just noticed strikethrough text handling was not implemented for the following: Chat  Markdown Preview  Code Documentation  It looks like there are three different markdown parsing/rendering implementations, might be worth to investigate if any of these can be combined into a single crate (looks like a lot of work though). Release Notes: - Added support for rendering strikethrough text in markdown elements
This commit is contained in:
parent
cd8ede542b
commit
43163a0154
6 changed files with 187 additions and 69 deletions
|
@ -1,4 +1,6 @@
|
|||
use gpui::{px, FontStyle, FontWeight, HighlightStyle, SharedString, UnderlineStyle};
|
||||
use gpui::{
|
||||
px, FontStyle, FontWeight, HighlightStyle, SharedString, StrikethroughStyle, UnderlineStyle,
|
||||
};
|
||||
use language::HighlightId;
|
||||
use std::{ops::Range, path::PathBuf};
|
||||
|
||||
|
@ -170,6 +172,13 @@ impl MarkdownHighlight {
|
|||
});
|
||||
}
|
||||
|
||||
if style.strikethrough {
|
||||
highlight.strikethrough = Some(StrikethroughStyle {
|
||||
thickness: px(1.),
|
||||
..Default::default()
|
||||
});
|
||||
}
|
||||
|
||||
if style.weight != FontWeight::default() {
|
||||
highlight.font_weight = Some(style.weight);
|
||||
}
|
||||
|
@ -189,6 +198,8 @@ pub struct MarkdownHighlightStyle {
|
|||
pub italic: bool,
|
||||
/// Whether the text should be underlined.
|
||||
pub underline: bool,
|
||||
/// Whether the text should be struck through.
|
||||
pub strikethrough: bool,
|
||||
/// The weight of the text.
|
||||
pub weight: FontWeight,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue