aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPolesznyák Márk <contact@pml68.dev>2025-10-20 12:47:36 +0200
committerPolesznyák Márk <contact@pml68.dev>2025-10-20 12:51:08 +0200
commite7509d41405a1f5af64f2f74166f2bc5f1673225 (patch)
treec2e56fb086d83938d4c40238afccc66f925caacb
parentfix: markdown `Viewer` impl (diff)
downloadiced_selection-e7509d41405a1f5af64f2f74166f2bc5f1673225.tar.gz
feat: make markdown support optional with a feature flag
-rw-r--r--.builds/ci.yml5
-rw-r--r--Cargo.toml19
-rw-r--r--examples/name/Cargo.toml8
-rw-r--r--examples/name/src/main.rs (renamed from examples/name.rs)1
-rw-r--r--examples/rich/Cargo.toml9
-rw-r--r--examples/rich/src/main.rs (renamed from examples/iced.rs)1
-rw-r--r--src/lib.rs2
7 files changed, 35 insertions, 10 deletions
diff --git a/.builds/ci.yml b/.builds/ci.yml
index aed0e26..689ad52 100644
--- a/.builds/ci.yml
+++ b/.builds/ci.yml
@@ -19,6 +19,7 @@ tasks:
cd iced_selection
cargo test --verbose --doc
cargo test --verbose --all-targets
- - build-example: |
+ - build-examples: |
cd iced_selection
- cargo build --example name
+ cargo build --package name
+ cargo build --package rich
diff --git a/Cargo.toml b/Cargo.toml
index 849c30e..a2c7a29 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,16 +13,23 @@ categories = ["gui"]
keywords = ["gui", "ui", "graphics", "interface", "widgets"]
rust-version = "1.88"
+[features]
+default = []
+markdown = ["iced_widget/markdown"]
+
[dependencies]
-iced_widget = { git = "https://github.com/iced-rs/iced", features = [
- "markdown",
-] }
-unicode-segmentation = "1.0"
+iced_widget.workspace = true
+unicode-segmentation.workspace = true
-[dev-dependencies]
-iced = { git = "https://github.com/iced-rs/iced", features = ["markdown"] }
+[workspace.dependencies]
+iced_widget = { git = "https://github.com/iced-rs/iced" }
+unicode-segmentation = "1.0"
+iced = { git = "https://github.com/iced-rs/iced" }
open = "5.3"
+[workspace]
+members = ["examples/*"]
+
[package.metadata.docs.rs]
rustdoc-args = ["--cfg", "docsrs"]
all-features = true
diff --git a/examples/name/Cargo.toml b/examples/name/Cargo.toml
new file mode 100644
index 0000000..23c3b58
--- /dev/null
+++ b/examples/name/Cargo.toml
@@ -0,0 +1,8 @@
+[package]
+name = "name"
+version = "0.0.0"
+edition = "2024"
+
+[dependencies]
+iced.workspace = true
+iced_selection = { path = "../.." }
diff --git a/examples/name.rs b/examples/name/src/main.rs
index 6d0edec..2a733d5 100644
--- a/examples/name.rs
+++ b/examples/name/src/main.rs
@@ -1,4 +1,3 @@
-#![allow(missing_docs)]
use iced::widget::{center, column, text_input};
use iced::{Center, Element};
use iced_selection::text;
diff --git a/examples/rich/Cargo.toml b/examples/rich/Cargo.toml
new file mode 100644
index 0000000..a016a5e
--- /dev/null
+++ b/examples/rich/Cargo.toml
@@ -0,0 +1,9 @@
+[package]
+name = "rich"
+version = "0.0.0"
+edition = "2024"
+
+[dependencies]
+iced.workspace = true
+iced_selection = { path = "../.." }
+open.workspace = true
diff --git a/examples/iced.rs b/examples/rich/src/main.rs
index e031d08..6c47e0f 100644
--- a/examples/iced.rs
+++ b/examples/rich/src/main.rs
@@ -1,4 +1,3 @@
-#![allow(missing_docs)]
use iced::widget::{center, column, responsive};
use iced::{Center, Element, color};
use iced_selection::{rich_text, span};
diff --git a/src/lib.rs b/src/lib.rs
index a4c6a44..a3cb57c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -2,12 +2,14 @@
//!
//! [`Paragraph`]: https://docs.iced.rs/iced_graphics/text/paragraph/struct.Paragraph.html
+#[cfg(feature = "markdown")]
pub mod markdown;
pub mod selection;
pub mod text;
use iced_widget::core;
use iced_widget::graphics::text::Paragraph;
+#[cfg(feature = "markdown")]
pub use markdown::view as markdown;
#[doc(no_inline)]
pub use text::Text;