Skip to content

Commit

Permalink
feat: export markdown iced feature
Browse files Browse the repository at this point in the history
  • Loading branch information
wiiznokes authored and mmstick committed Nov 7, 2024
1 parent 3c5a2d9 commit 568ff09
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
13 changes: 13 additions & 0 deletions src/theme/style/iced.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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>() -> <Self as iced_container::Catalog>::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()
})
}
}
4 changes: 4 additions & 0 deletions src/widget/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit 568ff09

Please sign in to comment.