- 
                Notifications
    
You must be signed in to change notification settings  - Fork 237
 
Closed
Description
Sample program:
let markdown = "*Here's some **markdown** with a [link](https://khanlou.com)*"
let html = HTMLFormatter.format(markdown)
print(html)
Output:
<p><em>Here’s some markdown with a link</em></p>
Expected output:
<p><em>Here's some <strong>markdown</strong> with a <a href="https://khanlou.com">link</a></em></p>
Version:
Commit 82f9258
As far as I can tell, this is because Emphasis.inlineText doesn't include any nested content, it just includes the displayed text.
This can be fixed by changing the implementation of visitEmphasis from this:
public mutating func visitEmphasis(_ emphasis: Emphasis) -> () {
    printInline(tag: "em", emphasis)
}
To this:
public mutating func visitEmphasis(_ emphasis: Emphasis) -> () {
    result += "<em>"
    descendInto(emphasis)
    result += "</em>"
}
The same thing probably needs to be done to the del tag and the strong tag. If there is interest in this fix I can open a PR?
Metadata
Metadata
Assignees
Labels
No labels