Make markdown::parse take a Palette value

This commit is contained in:
Héctor Ramón Jiménez 2024-07-28 13:59:11 +02:00
parent 2796a6bc97
commit 2d69464846
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
2 changed files with 6 additions and 6 deletions

View file

@ -28,7 +28,7 @@ impl Markdown {
( (
Self { Self {
content: text_editor::Content::with_text(INITIAL_CONTENT), content: text_editor::Content::with_text(INITIAL_CONTENT),
items: markdown::parse(INITIAL_CONTENT, &theme.palette()) items: markdown::parse(INITIAL_CONTENT, theme.palette())
.collect(), .collect(),
theme, theme,
}, },
@ -46,7 +46,7 @@ impl Markdown {
if is_edit { if is_edit {
self.items = markdown::parse( self.items = markdown::parse(
&self.content.text(), &self.content.text(),
&self.theme.palette(), self.theme.palette(),
) )
.collect(); .collect();
} }

View file

@ -35,10 +35,10 @@ pub enum Item {
} }
/// Parse the given Markdown content. /// Parse the given Markdown content.
pub fn parse<'a>( pub fn parse(
markdown: &'a str, markdown: &str,
palette: &'a theme::Palette, palette: theme::Palette,
) -> impl Iterator<Item = Item> + 'a { ) -> impl Iterator<Item = Item> + '_ {
struct List { struct List {
start: Option<u64>, start: Option<u64>,
items: Vec<Vec<Item>>, items: Vec<Vec<Item>>,