@@ -27,16 +27,15 @@ pub struct Markdown {
27// better yet, just use Tendril + subtendril for references
27// better yet, just use Tendril + subtendril for references
29impl Markdown {
29impl Markdown {
30− // theme keys, including fallbacks
31− const TEXT_STYLE: [&'static str; 2] = ["ui.text", "ui"];
30+ const TEXT_STYLE: &'static str = "ui.text";
32− const BLOCK_STYLE: [&'static str; 3] = ["markup.raw.inline", "markup.raw", "markup"];
31+ const BLOCK_STYLE: &'static str = "markup.raw.inline";
33− const HEADING_STYLES: [[&'static str; 3]; 6] = [
32+ const HEADING_STYLES: [&'static str; 6] = [
34− ["markup.heading.1", "markup.heading", "markup"],
33+ "markup.heading.1",
35− ["markup.heading.2", "markup.heading", "markup"],
34+ "markup.heading.2",
36− ["markup.heading.3", "markup.heading", "markup"],
35+ "markup.heading.3",
37− ["markup.heading.4", "markup.heading", "markup"],
36+ "markup.heading.4",
38− ["markup.heading.5", "markup.heading", "markup"],
37+ "markup.heading.5",
39− ["markup.heading.6", "markup.heading", "markup"],
38+ "markup.heading.6",
42 pub fn new(contents: String, config_loader: Arc<syntax::Loader>) -> Self {
41 pub fn new(contents: String, config_loader: Arc<syntax::Loader>) -> Self {
@@ -59,15 +58,9 @@ impl Markdown {
59 let mut spans = Vec::new();
58 let mut spans = Vec::new();
60 let mut lines = Vec::new();
59 let mut lines = Vec::new();
62− let get_theme = |keys: &[&str]| match theme {
65− .find_map(|key| theme.try_get(key))
66− .unwrap_or_default(),
61+ let get_theme = |key: &str| -> Style { theme.map(|t| t.get(key)).unwrap_or_default() };
67− None => Default::default(),
69− let text_style = get_theme(&Self::TEXT_STYLE);
62+ let text_style = get_theme(Self::TEXT_STYLE);
70− let code_style = get_theme(&Self::BLOCK_STYLE);
63+ let code_style = get_theme(Self::BLOCK_STYLE);
71 let heading_styles: Vec<Style> = Self::HEADING_STYLES
64 let heading_styles: Vec<Style> = Self::HEADING_STYLES
73 .map(|key| get_theme(key))
66 .map(|key| get_theme(key))