diff --git a/Sources/Ignite/Framework/ForEach.swift b/Sources/Ignite/Framework/ForEach.swift index 42a77ab1..7e71bdfa 100644 --- a/Sources/Ignite/Framework/ForEach.swift +++ b/Sources/Ignite/Framework/ForEach.swift @@ -6,7 +6,7 @@ // /// A structure that creates HTML content by mapping over a sequence of data. -public struct ForEach: InlineHTML, BlockHTML { +public struct ForEach: InlineHTML, BlockHTML, ListableElement { /// The body content created by mapping over the data sequence. public var body: some HTML { self } @@ -46,4 +46,12 @@ public struct ForEach: InlineHTML, BlockHTML { return output } + + /// Renders the ForEach content when this isn't part of a list. + /// - Parameter context: The current publishing context. + /// - Returns: The rendered HTML string. + func renderInList(context: PublishingContext) -> String { + // ListableElement conformance ensures other views never wrap ForEach in
  • tags. + render(context: context) + } } diff --git a/Sources/Ignite/Modifiers/FontWeightModifier.swift b/Sources/Ignite/Modifiers/FontWeightModifier.swift index a6b2efe3..82e2c7f4 100644 --- a/Sources/Ignite/Modifiers/FontWeightModifier.swift +++ b/Sources/Ignite/Modifiers/FontWeightModifier.swift @@ -26,3 +26,12 @@ public extension HTML { modifier(FontWeightModifier(weight: newWeight)) } } + +public extension InlineHTML { + /// Adjusts the font weight (boldness) of this font. + /// - Parameter newWeight: The new font weight. + /// - Returns: A new `Text` instance with the updated weight. + func fontWeight(_ newWeight: Font.Weight) -> some InlineHTML { + modifier(FontWeightModifier(weight: newWeight)) + } +}