From 4c883f12b4761c7e0b273d9a2380552336f61d96 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 22 Aug 2024 02:24:06 +0200 Subject: Make `RichText` generic over data structure ... and decouple `markdown::parse` from theming --- examples/markdown/src/main.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'examples/markdown') diff --git a/examples/markdown/src/main.rs b/examples/markdown/src/main.rs index eb51f985..5605478f 100644 --- a/examples/markdown/src/main.rs +++ b/examples/markdown/src/main.rs @@ -29,8 +29,7 @@ impl Markdown { ( Self { content: text_editor::Content::with_text(INITIAL_CONTENT), - items: markdown::parse(INITIAL_CONTENT, theme.palette()) - .collect(), + items: markdown::parse(INITIAL_CONTENT).collect(), theme, }, widget::focus_next(), @@ -45,11 +44,8 @@ impl Markdown { self.content.perform(action); if is_edit { - self.items = markdown::parse( - &self.content.text(), - self.theme.palette(), - ) - .collect(); + self.items = + markdown::parse(&self.content.text()).collect(); } } Message::LinkClicked(link) => { @@ -67,8 +63,12 @@ impl Markdown { .font(Font::MONOSPACE) .highlight("markdown", highlighter::Theme::Base16Ocean); - let preview = markdown(&self.items, markdown::Settings::default()) - .map(Message::LinkClicked); + let preview = markdown( + &self.items, + markdown::Settings::default(), + markdown::Style::from_palette(self.theme.palette()), + ) + .map(Message::LinkClicked); row![editor, scrollable(preview).spacing(10).height(Fill)] .spacing(10) -- cgit