Different header sizes

This commit is contained in:
2025-07-10 19:50:38 +02:00
parent 3a2f058456
commit 276508713f
3 changed files with 34 additions and 5 deletions

View File

@ -1,5 +1,7 @@
use egui::text::{CCursorRange, LayoutJob};
use crate::markdown::Heading;
use super::{Item, Style, parse};
/// Highlight markdown, caching previous output to save CPU.
@ -71,8 +73,15 @@ fn format_from_style(egui_style: &egui::Style, style: &Style) -> egui::text::Tex
egui_style.visuals.text_color()
};
let text_style = if style.heading.is_some() {
TextStyle::Heading
let text_style = if let Some(heading) = style.heading {
match heading {
Heading::H1 => TextStyle::Name("H1".into()),
Heading::H2 => TextStyle::Name("H2".into()),
Heading::H3 => TextStyle::Name("H3".into()),
Heading::H4 => TextStyle::Name("H4".into()),
Heading::H5 => TextStyle::Name("H5".into()),
Heading::H6 => TextStyle::Name("H6".into()),
}
} else if style.code {
TextStyle::Monospace
} else if style.small | style.raised {