feat: Initial commit

This commit is contained in:
2024-12-02 17:04:28 -05:00
commit 22dfc6ce51
18 changed files with 505 additions and 0 deletions

27
Sources/CliDoc/Node.swift Normal file
View File

@@ -0,0 +1,27 @@
public protocol NodeRepresentable {
func render() -> String
}
public protocol Node: NodeRepresentable {
// swiftlint:disable type_name
associatedtype _Body: Node
typealias Body = _Body
// swiftlint:enable type_name
@NodeBuilder
var body: Body { get }
}
public extension Node {
func render() -> String {
body.render()
}
}
extension String: NodeRepresentable {
public func render() -> String { self }
}
extension String: Node {
public var body: some Node { self }
}