Add a `blank_line()` method to `Builder`
continuous-integration/drone/pr Build is failing Details

Many times users may want to seperate lines of text using a blank line.  Currently, this can be accomplished by either adding '\n' to the previous `text()` call, which requires that the user has the ability to access this, and can also look a little messy, or by calling `text()` with an empty string, which definately works, but having an explicit method might be a nice sugar for a lot of users, and barely adds any weight to the codebase.

This is definately a small thing, and almost closer to a personal preferance than anything, but I definately think it would make the library a tiny bit nicer to use, and there's barely any tradeoff.  It's still up to you though if you'd rather keep your codebase small.
This commit is contained in:
Emii Tatsuo 2020-11-30 01:11:12 -05:00
parent c743056263
commit ac88fb60ee
No known key found for this signature in database
GPG Key ID: 68FAB2E2E6DFC98B
1 changed files with 11 additions and 0 deletions

View File

@ -18,6 +18,17 @@ impl Builder {
self
}
/// Append a single blank line to the document
///
/// This is equivilent to calling [`text()`] with an empty string, or pushing a blank
/// [`Node`]
///
/// [`text()`]: Self::text()
pub fn blank_line(mut self) -> Self {
self.nodes.push(Node::blank());
self
}
pub fn link<T: Into<String>>(mut self, to: T, name: Option<String>) -> Builder {
self.nodes.push(Node::Link {
to: to.into(),