summaryrefslogtreecommitdiff
path: root/library/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'library/src/shared')
-rw-r--r--library/src/shared/ext.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/library/src/shared/ext.rs b/library/src/shared/ext.rs
index 2d2dc751..4fd1f161 100644
--- a/library/src/shared/ext.rs
+++ b/library/src/shared/ext.rs
@@ -13,6 +13,9 @@ pub trait ContentExt {
/// Underline this content.
fn underlined(self) -> Self;
+ /// Link the content to a destination.
+ fn linked(self, dest: Destination) -> Self;
+
/// Force a size for this content.
fn boxed(self, sizing: Axes<Option<Rel<Length>>>) -> Self;
@@ -45,6 +48,10 @@ impl ContentExt for Content {
crate::text::DecoNode::<{ crate::text::UNDERLINE }>(self).pack()
}
+ fn linked(self, dest: Destination) -> Self {
+ self.styled(Meta::DATA, vec![Meta::Link(dest.clone())])
+ }
+
fn boxed(self, sizing: Axes<Option<Rel<Length>>>) -> Self {
crate::layout::BoxNode { sizing, child: self }.pack()
}