From 74c2419ad056c352a04d79012f709b9fb268783f Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Tue, 15 Nov 2022 16:05:59 +0100 Subject: [PATCH] Fix OmitLinks support --- html2text.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html2text.go b/html2text.go index 657c3fb..8fe9000 100644 --- a/html2text.go +++ b/html2text.go @@ -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 + " )" } }