Skip to content

Commit

Permalink
Fix OmitLinks support
Browse files Browse the repository at this point in the history
  • Loading branch information
flimzy authored and jaytaylor committed Mar 21, 2023
1 parent bc68cce commit 74c2419
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion html2text.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ func (ctx *textifyTraverseContext) handleElement(node *html.Node) error {
if attrVal := getAttrVal(node, "href"); attrVal != "" {
attrVal = ctx.normalizeHrefLink(attrVal)
// Don't print link href if it matches link element content or if the link is empty.
if (!ctx.options.OmitLinks && attrVal != "" && linkText != attrVal) || !ctx.options.TextOnly {
if (attrVal != "" && linkText != attrVal) && !ctx.options.OmitLinks && !ctx.options.TextOnly {
hrefLink = "( " + attrVal + " )"
}
}
Expand Down

0 comments on commit 74c2419

Please sign in to comment.