diff -r 6461e0637767 -r 4bf4f6ce268e printer/html2text/html2text.go --- a/printer/html2text/html2text.go Sat May 13 11:56:52 2017 +0200 +++ b/printer/html2text/html2text.go Sat May 13 12:36:38 2017 +0200 @@ -116,6 +116,11 @@ last = b.Bytes()[bl-1] } + // Add heading space if needed + if last != ' ' && last != '\n' && last != '#' && last != '@' { + b.WriteString(" ") + } + var tmpbuf bytes.Buffer for c := n.FirstChild; c != nil; c = c.NextSibling { process(c, &tmpbuf, class) @@ -126,11 +131,6 @@ return } - // Add heading space if needed - if last != ' ' && last != '\n' { - b.WriteString(" ") - } - s := tmpbuf.String() if strings.HasPrefix(s, "#") || strings.HasPrefix(s, "@") { b.WriteString(s) // Tag or mention: display content