Skip to content

Commit c90813a

Browse files
committed
Format links in the documentation markdown from SourceKit
1 parent efb5adf commit c90813a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Sources/SourceKitLSP/Swift/CommentXML.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,16 @@ private struct XMLToMarkdown {
157157
toMarkdown(node.children)
158158
out += "\n\n"
159159

160+
case "Link":
161+
if let href = node.attributes?.first(where: { $0.name == "href" })?.stringValue {
162+
out += "["
163+
toMarkdown(node.children)
164+
out += "](\(href))"
165+
} else {
166+
// Not a valid link.
167+
toMarkdown(node.children)
168+
}
169+
160170
default:
161171
toMarkdown(node.children)
162172
}

0 commit comments

Comments
 (0)