diff --git a/Sources/Ignite/Elements/Image.swift b/Sources/Ignite/Elements/Image.swift index 670787cfb..69916a80f 100644 --- a/Sources/Ignite/Elements/Image.swift +++ b/Sources/Ignite/Elements/Image.swift @@ -120,7 +120,7 @@ public struct Image: InlineElement, LazyLoadable { return Markup("") } - var output = "" + var output = Markup("") if let darkSourceSet = generateSourceSet(darkVariants), let value = darkSourceSet.value { output += "" @@ -129,7 +129,7 @@ public struct Image: InlineElement, LazyLoadable { // Add the fallback img tag output += "" output += "" - return Markup(output) + return output } /// Renders this element using publishing context passed in. diff --git a/Sources/Ignite/Elements/Include.swift b/Sources/Ignite/Elements/Include.swift index 09c6899c3..7d5859100 100644 --- a/Sources/Ignite/Elements/Include.swift +++ b/Sources/Ignite/Elements/Include.swift @@ -34,7 +34,7 @@ public struct Include: HTML { do { let string = try String(contentsOf: fileURL) - return Markup(string) + return Markup(verbatim: string) } catch { publishingContext.addWarning(""" Failed to find \(filename) in Includes folder; \ diff --git a/Sources/Ignite/Elements/List.swift b/Sources/Ignite/Elements/List.swift index eeb4b43b9..a93266cc5 100644 --- a/Sources/Ignite/Elements/List.swift +++ b/Sources/Ignite/Elements/List.swift @@ -162,7 +162,7 @@ public struct List: HTML { public func markup() -> Markup { let listAttributes = getAttributes() - var output = "<\(listElementName)\(listAttributes)>" + var output: Markup = "<\(listElementName)\(listAttributes)>" for originalItem in items { var item = originalItem @@ -173,7 +173,7 @@ public struct List: HTML { if listStyle != .automatic { listableItem.attributes.append(classes: "list-group-item") } - output += listableItem.listMarkup().string + output += listableItem.listMarkup() } else { let styleClass = listStyle == .automatic ? "" : " class=\"list-group-item\"" item.attributes.append(classes: "m-0") @@ -183,6 +183,6 @@ public struct List: HTML { output += "" - return Markup(output) + return output } } diff --git a/Sources/Ignite/Elements/PlainDocument.swift b/Sources/Ignite/Elements/PlainDocument.swift index 4224097c3..682c38b88 100644 --- a/Sources/Ignite/Elements/PlainDocument.swift +++ b/Sources/Ignite/Elements/PlainDocument.swift @@ -42,11 +42,11 @@ public struct PlainDocument: Document, HTML { // Deferred head rendering to accommodate for context updates during body rendering let headMarkup = head.markup() - var output = "" + var output: Markup = "" output += "" - output += headMarkup.string - output += bodyMarkup.string + output += headMarkup + output += bodyMarkup output += "" - return Markup(output) + return output } } diff --git a/Sources/Ignite/Elements/String.swift b/Sources/Ignite/Elements/String.swift index a93dcc41e..df33a80bc 100644 --- a/Sources/Ignite/Elements/String.swift +++ b/Sources/Ignite/Elements/String.swift @@ -14,6 +14,6 @@ extension String: InlineElement, FormItem { /// Renders this element using publishing context passed in. /// - Returns: The HTML for this element. public func markup() -> Markup { - Markup(self) + Markup(verbatim: self) } } diff --git a/Sources/Ignite/Elements/Table.swift b/Sources/Ignite/Elements/Table.swift index 2a87a0cba..1f495bf87 100644 --- a/Sources/Ignite/Elements/Table.swift +++ b/Sources/Ignite/Elements/Table.swift @@ -164,7 +164,7 @@ public struct Table: HTML { tableAttributes.append(classes: ["table-striped-columns"]) } - var output = "" + var output = Markup() if let filterTitle { tableAttributes.id = "table-\(UUID().uuidString.truncatedHash)" @@ -190,9 +190,9 @@ public struct Table: HTML { } output += "" - output += rows.markupString() + output += Markup(verbatim: rows.markupString()) output += "" output += "" - return Markup(output) + return output } } diff --git a/Sources/Ignite/Elements/Text.swift b/Sources/Ignite/Elements/Text.swift index 8cd4d39e2..4dc904bfc 100644 --- a/Sources/Ignite/Elements/Text.swift +++ b/Sources/Ignite/Elements/Text.swift @@ -160,11 +160,7 @@ public struct Text: HTML, DropdownItem { .attributes(attributes) .markup() } else { - Markup( - "<\(font.rawValue)\(attributes)>" + - content.markupString() + - "" - ) + Markup("<\(font.rawValue)\(attributes)>\(content.markupString())") } } } diff --git a/Sources/Ignite/Elements/Video.swift b/Sources/Ignite/Elements/Video.swift index e41d24229..1cfbfc500 100644 --- a/Sources/Ignite/Elements/Video.swift +++ b/Sources/Ignite/Elements/Video.swift @@ -34,7 +34,7 @@ public struct Video: InlineElement, LazyLoadable { /// - files: The user videos to render. /// - Returns: The HTML for this element. private func render(files: [String]) -> Markup { - var output = "