From 568ff097d67b93eef646d2f86937935438dba4dd Mon Sep 17 00:00:00 2001 From: wiiznokes <78230769+wiiznokes@users.noreply.github.com> Date: Thu, 7 Nov 2024 01:15:04 +0100 Subject: [PATCH] feat: export markdown iced feature --- Cargo.toml | 1 + src/theme/style/iced.rs | 13 +++++++++++++ src/widget/mod.rs | 4 ++++ 3 files changed, 18 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 3567c2a..19cb553 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 79b7dde..8a49ec0 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 ecce1a8..6c7fcd0 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;