Skip to content

Commit 8cd2f36

Browse files
committed
refactor: Generalize Title::title to Title::text
1 parent 0bae055 commit 8cd2f36

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/level.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ impl<'a> Level<'a> {
8080
/// not allowed to be passed to this function.
8181
///
8282
/// </div>
83-
pub fn title(self, title: impl Into<Cow<'a, str>>) -> Title<'a> {
83+
pub fn title(self, text: impl Into<Cow<'a, str>>) -> Title<'a> {
8484
Title {
8585
level: self,
8686
id: None,
87-
title: title.into(),
87+
text: text.into(),
8888
is_pre_styled: false,
8989
}
9090
}
@@ -97,11 +97,11 @@ impl<'a> Level<'a> {
9797
/// used to normalize untrusted text before it is passed to this function.
9898
///
9999
/// </div>
100-
pub fn pre_styled_title(self, title: impl Into<Cow<'a, str>>) -> Title<'a> {
100+
pub fn pre_styled_title(self, text: impl Into<Cow<'a, str>>) -> Title<'a> {
101101
Title {
102102
level: self,
103103
id: None,
104-
title: title.into(),
104+
text: text.into(),
105105
is_pre_styled: true,
106106
}
107107
}

src/renderer/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,9 +585,9 @@ impl Renderer {
585585
});
586586

587587
let (title_str, style) = if title.is_pre_styled {
588-
(title.title.to_string(), ElementStyle::NoStyle)
588+
(title.text.to_string(), ElementStyle::NoStyle)
589589
} else {
590-
(normalize_whitespace(&title.title), title_element_style)
590+
(normalize_whitespace(&title.text), title_element_style)
591591
};
592592
for (i, text) in title_str.lines().enumerate() {
593593
if i != 0 {

src/snippet.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ pub struct Padding;
110110
pub struct Title<'a> {
111111
pub(crate) level: Level<'a>,
112112
pub(crate) id: Option<Id<'a>>,
113-
pub(crate) title: Cow<'a, str>,
113+
pub(crate) text: Cow<'a, str>,
114114
pub(crate) is_pre_styled: bool,
115115
}
116116

0 commit comments

Comments
 (0)