feat: Working on documentation
This commit is contained in:
@@ -37,16 +37,11 @@
|
||||
///
|
||||
/// print(mySection.render())
|
||||
/// ```
|
||||
/// **Note:** colored output / styling only shows in the terminal.
|
||||
///
|
||||
/// ```bash
|
||||
/// _Below is an image of the output from the `mySection.render()` above._
|
||||
///
|
||||
/// Awesome
|
||||
/// 
|
||||
///
|
||||
/// My super awesome section
|
||||
///
|
||||
/// Note: this is super awesome
|
||||
/// ```
|
||||
public struct Section<Header: TextNode, Content: TextNode, Footer: TextNode>: TextNode {
|
||||
|
||||
@usableFromInline
|
||||
@@ -124,7 +119,8 @@ public extension Section {
|
||||
}
|
||||
}
|
||||
|
||||
/// Holds the type-erased values of a ``Section``, used to style a section.
|
||||
/// Holds the type-erased values of a ``Section``, that can be used to create
|
||||
/// custom styling for a section.
|
||||
public struct SectionConfiguration {
|
||||
/// The type-erased header of a section.
|
||||
public let header: any TextNode
|
||||
@@ -143,6 +139,9 @@ public struct SectionConfiguration {
|
||||
}
|
||||
}
|
||||
|
||||
/// Used to declare a custom style for a ``Section``. Your custom section style
|
||||
/// must conform to this protocol.
|
||||
///
|
||||
public protocol SectionStyle: TextModifier where Content == SectionConfiguration {}
|
||||
|
||||
public extension SectionStyle where Self == DefaultSectionStyle {
|
||||
|
||||
@@ -1,7 +1,23 @@
|
||||
/// A namespace for separator types that are used in text nodes.
|
||||
///
|
||||
/// These are generally used in the ``HStack``'s and ``VStack``'s to
|
||||
/// specifiy how the nodes they contain are separated.
|
||||
///
|
||||
///
|
||||
/// **Note:**
|
||||
///
|
||||
/// > By default nodes do not contain any separators, unless they are written inline.
|
||||
/// > However, both ``HStack`` and ``VStack`` allow you to specify the separator to use
|
||||
/// > to control how the individual nodes they contain are separated.
|
||||
///
|
||||
public enum Separator {
|
||||
|
||||
/// Represents a horizontal separator that can be used between text nodes, typically inside
|
||||
/// an ``HStack``
|
||||
///
|
||||
/// **Note:**
|
||||
/// > By default nodes do not contain any separators, unless they are written inline.
|
||||
///
|
||||
public enum Horizontal: TextNode {
|
||||
/// Separate nodes by spaces of the given count.
|
||||
case space(count: Int = 1)
|
||||
@@ -10,6 +26,12 @@ public enum Separator {
|
||||
case tab(count: Int = 1)
|
||||
|
||||
/// Separate nodes by the provided string of the given count.
|
||||
///
|
||||
/// **Note:**
|
||||
///
|
||||
/// > This can allow for non-sensical separators, so should only be used
|
||||
/// > if the provided horizontal separators do not work for you.
|
||||
///
|
||||
case custom(String, count: Int = 1)
|
||||
|
||||
@TextBuilder
|
||||
@@ -28,8 +50,34 @@ public enum Separator {
|
||||
|
||||
/// Represents a vertical separator that can be used between text nodes, typically inside
|
||||
/// a ``VStack``
|
||||
///
|
||||
/// **Note:**
|
||||
/// > By default nodes do not contain any separators, so if you would
|
||||
/// > like a blank line separating nodes, then a count of `2` is required.
|
||||
/// > A count of `1` will place nodes on the next line.
|
||||
///
|
||||
public enum Vertical: TextNode {
|
||||
/// Separate nodes by new line characters of the given count.
|
||||
///
|
||||
/// **Note:**
|
||||
/// > By default nodes do not contain any separtors, so if you would
|
||||
/// > like a blank line separating nodes, then a count of `2` is required.
|
||||
/// > A count of `1` will place nodes on the next line.
|
||||
///
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - count: The count of the new lines to use.
|
||||
case newLine(count: Int = 1)
|
||||
|
||||
/// Separate nodes by the supplied string with the given count.
|
||||
///
|
||||
/// **Note:**
|
||||
///
|
||||
/// > This can allow for non-sensical separators, so should only be used
|
||||
/// > if the provided vertical separators do not work for you.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - count: The count of the new lines to use.
|
||||
case custom(String, count: Int = 1)
|
||||
|
||||
@TextBuilder
|
||||
|
||||
Reference in New Issue
Block a user