Skip to content

Commit 6f68950

Browse files
committed
Add NoStrongs option
This enables ignoring <b> and <strong> tags. It's based on jaytaylor#38 by @jypelle.
1 parent aab264b commit 6f68950

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

html2text.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ type Options struct {
1818
PrettyTables bool // Turns on pretty ASCII rendering for table elements.
1919
PrettyTablesOptions *PrettyTablesOptions // Configures pretty ASCII rendering for table elements.
2020
OmitLinks bool // Turns on omitting links
21+
NoStrongs bool // Ignores <b> and <strong> tags
2122
TightLinks bool // Removes whitespace around links
2223
}
2324

@@ -231,6 +232,9 @@ func (ctx *textifyTraverseContext) handleElement(node *html.Node) error {
231232
return err
232233
}
233234
str := subCtx.buf.String()
235+
if ctx.options.NoStrongs {
236+
return ctx.emit(str)
237+
}
234238
return ctx.emit("*" + str + "*")
235239

236240
case atom.A:

0 commit comments

Comments
 (0)