summaryrefslogtreecommitdiff
path: root/src/library/structure/heading.rs
diff options
context:
space:
mode:
authorMartin Haug <mhaug@live.de>2022-06-04 12:57:45 +0200
committerMartin Haug <mhaug@live.de>2022-06-04 12:57:45 +0200
commit4640585fbdf72df993dbed46799844aa78996cce (patch)
tree38a09389885a61068970441d6d27178a2ae4f115 /src/library/structure/heading.rs
parenta937462491a63f5cff3551b5bb8bc45fb350f0b6 (diff)
First iteration of outline items
Diffstat (limited to 'src/library/structure/heading.rs')
-rw-r--r--src/library/structure/heading.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/library/structure/heading.rs b/src/library/structure/heading.rs
index a0973b90..285793dd 100644
--- a/src/library/structure/heading.rs
+++ b/src/library/structure/heading.rs
@@ -1,6 +1,7 @@
use crate::library::layout::BlockSpacing;
use crate::library::prelude::*;
use crate::library::text::{FontFamily, TextNode, TextSize};
+use crate::model::StyleEntry;
/// A section heading.
#[derive(Debug, Hash)]
@@ -65,7 +66,13 @@ impl HeadingNode {
impl Show for HeadingNode {
fn unguard(&self, sel: Selector) -> ShowNode {
- Self { body: self.body.unguard(sel), ..*self }.pack()
+ let mut map = StyleMap::with_role(Role::Heading(self.level.get()));
+ map.push(StyleEntry::Unguard(sel));
+ Self {
+ body: self.body.clone().styled_with_map(map),
+ ..*self
+ }
+ .pack()
}
fn encode(&self, _: StyleChain) -> Dict {
@@ -91,7 +98,8 @@ impl Show for HeadingNode {
};
}
- let mut map = StyleMap::new();
+ let mut map = StyleMap::with_role(Role::Heading(self.level.get()));
+
map.set(TextNode::SIZE, resolve!(Self::SIZE));
if let Smart::Custom(family) = resolve!(Self::FAMILY) {