Skip to content

Commit 3588f04

Browse files
authored
Fixes #209, inline tag content is doesn't include nested tags (#210)
Fixes #209
1 parent 82f9258 commit 3588f04

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Sources/Markdown/Walker/Walkers/HTMLFormatter.swift

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,16 +215,14 @@ public struct HTMLFormatter: MarkupWalker {
215215

216216
// MARK: Inline elements
217217

218-
mutating func printInline(tag: String, content: String) {
219-
result += "<\(tag)>\(content)</\(tag)>"
220-
}
221-
222-
mutating func printInline(tag: String, _ inline: InlineMarkup) {
223-
printInline(tag: tag, content: inline.plainText)
218+
mutating func printInline(tag: String, _ content: Markup) {
219+
result += "<\(tag)>"
220+
descendInto(content)
221+
result += "</\(tag)>"
224222
}
225223

226224
public mutating func visitInlineCode(_ inlineCode: InlineCode) -> () {
227-
printInline(tag: "code", content: inlineCode.code)
225+
result += "<code>\(inlineCode.code)</code>"
228226
}
229227

230228
public mutating func visitEmphasis(_ emphasis: Emphasis) -> () {
@@ -283,7 +281,7 @@ public struct HTMLFormatter: MarkupWalker {
283281

284282
public mutating func visitSymbolLink(_ symbolLink: SymbolLink) -> () {
285283
if let destination = symbolLink.destination {
286-
printInline(tag: "code", content: destination)
284+
result += "<code>\(destination)</code>"
287285
}
288286
}
289287

0 commit comments

Comments
 (0)