feat: Adds stacks, working on styles
This commit is contained in:
21
Sources/CliDoc/Utils.swift
Normal file
21
Sources/CliDoc/Utils.swift
Normal file
@@ -0,0 +1,21 @@
|
||||
@usableFromInline
|
||||
func array(from node: any TextNode) -> [any TextNode] {
|
||||
if let container = node as? NodeContainer {
|
||||
return container.nodes
|
||||
} else if let array = node as? [any TextNode] {
|
||||
return array
|
||||
} else {
|
||||
return [node]
|
||||
}
|
||||
}
|
||||
|
||||
@usableFromInline
|
||||
func seperator(_ separator: String, count: Int) -> any TextNode {
|
||||
assert(count >= 0, "Invalid count while creating a separator")
|
||||
|
||||
var output = ""
|
||||
for _ in 0 ... count {
|
||||
output += separator
|
||||
}
|
||||
return output
|
||||
}
|
||||
Reference in New Issue
Block a user