summaryrefslogtreecommitdiff
path: root/library/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'library/src/shared')
-rw-r--r--library/src/shared/ext.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/library/src/shared/ext.rs b/library/src/shared/ext.rs
index 72a82749..d7c80a30 100644
--- a/library/src/shared/ext.rs
+++ b/library/src/shared/ext.rs
@@ -18,6 +18,11 @@ pub trait ContentExt {
/// Link the content somewhere.
fn linked(self, dest: Destination) -> Self;
+ /// Make the content linkable by `.linked(Destination::Location(loc))`.
+ ///
+ /// Should be used in combination with [`Location::variant`].
+ fn backlinked(self, loc: Location) -> Self;
+
/// Set alignments for this content.
fn aligned(self, aligns: Axes<Option<GenAlign>>) -> Self;
@@ -45,6 +50,12 @@ impl ContentExt for Content {
self.styled(MetaElem::set_data(vec![Meta::Link(dest)]))
}
+ fn backlinked(self, loc: Location) -> Self {
+ let mut backlink = Content::empty();
+ backlink.set_location(loc);
+ self.styled(MetaElem::set_data(vec![Meta::Elem(backlink)]))
+ }
+
fn aligned(self, aligns: Axes<Option<GenAlign>>) -> Self {
self.styled(AlignElem::set_alignment(aligns))
}