diff --git a/Cargo.toml b/Cargo.toml index 3567c2a9d09..19cb553278b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -82,6 +82,7 @@ winit_wgpu = ["winit", "wgpu"] # Enables XDG portal integrations xdg-portal = ["ashpd"] qr_code = ["iced/qr_code"] +markdown = ["iced/markdown"] [dependencies] apply = "0.3.0" diff --git a/src/theme/style/iced.rs b/src/theme/style/iced.rs index 79b7dde24ee..8a49ec09a94 100644 --- a/src/theme/style/iced.rs +++ b/src/theme/style/iced.rs @@ -6,6 +6,7 @@ use crate::theme::{CosmicComponent, Theme, TRANSPARENT_COMPONENT}; use cosmic_theme::composite::over; use iced::{ + border, color, overlay::menu, widget::{ button as iced_button, checkbox as iced_checkbox, container as iced_container, pane_grid, @@ -1473,3 +1474,15 @@ impl iced_widget::text_editor::Catalog for Theme { } } } + +#[cfg(feature = "markdown")] +impl iced_widget::markdown::Catalog for Theme { + fn code_block<'a>() -> ::Class<'a> { + Container::custom(|_| iced_container::Style { + background: Some(color!(0x111111).into()), + text_color: Some(Color::WHITE), + border: border::rounded(2), + ..iced_container::Style::default() + }) + } +} diff --git a/src/widget/mod.rs b/src/widget/mod.rs index ecce1a86c03..6c7fcd08dfb 100644 --- a/src/widget/mod.rs +++ b/src/widget/mod.rs @@ -361,3 +361,7 @@ pub mod tooltip { pub mod warning; #[doc(inline)] pub use warning::*; + +#[cfg(feature = "markdown")] +#[doc(inline)] +pub use iced::widget::markdown;