Repository navigation
Releases: mailproto/textplain
Release list
v1.4.5
What's Changed
Deeply nested lists no longer multiply allocations, and ConvertNode allocates about two-thirds fewer objects on real email templates. Output is unchanged.
Performance
- List items are assembled in place instead of being copied out and rebuilt at every nesting level, so 1 MB of text inside 200 nested lists allocates 3.8 MB instead of 580 MB, and runs in 11.5 ms instead of 54 ms (#133)
- Link text, headings and table cells reuse the string already written instead of copying it out of the buffer. On the MJML template
ConvertNodegoes from 38 allocations to 21, and on a document with 200 links from 203 to 3 (#134)
Dependencies
- github.com/k3a/html2text 1.5.1, in the benchmarks module only (#115)
Full Changelog: v1.4.4...v1.4.5
v1.4.4
What's Changed
ConvertNode is about a third faster and allocates about half the bytes on real email templates. Output is unchanged.
Performance
fixSpacingcopies runs of plain ASCII in bulk and skips indentation in one scan;WordWrapreturns its input untouched when no line is too long; inline-style checks compare without lowercasing; options no longer escape to the heap (#131)fixSpacingreads the output buffer's bytes directly instead of a copy of them, table rows are walked without collecting them, and the 8-byte word reads are bounds checked once instead of eight times (#132)
ConvertNode at 990 columns on the corpus templates: 28–55% faster, and 47–55% fewer bytes allocated on builder-style templates. Convert, parse included, is 1–19% faster.
Full Changelog: v1.4.3...v1.4.4
v1.4.3
What's Changed
Email builder templates convert more cleanly: links repeated by an image and its caption are written once, struck-through prices are marked, and Markdown leaves inline images out.
Fixes
- When an image and the caption under it link to the same page, the link is written once, and a bare
( url )from an icon gives way to the text link after it (#128) - Spans struck through with an inline
text-decoration: line-throughstyle are marked like<del>, so a former price reads~~$48.00~~(#129) - Markdown leaves inline
data:images out of the output, keeping their alt text, and writes a link whose text is its own address as<url>(#126)
Maintenance
- Runnable examples for pkg.go.dev (#125)
- A builder-style MJML template and a 990-column row in the benchmarks (#124)
Full Changelog: v1.4.2...v1.4.3
v1.4.2
What's Changed
Faster conversion with less memory, deeply nested spans no longer multiply allocations, and spacers no longer leave blank-looking lines.
Performance
fixSpacingreads ASCII bytes directly, output buffers are pooled, and layout tables are rejected before their subtrees are walked.Convertis about 8% faster and allocates about 10% fewer bytes (#118)
Fixes
- Nested spans are converted in place rather than copied out at every level, so 1 MB of text inside 200 nested spans allocates 6.8 MB instead of 391 MB (#120)
- A no-break space at the start or end of a line, or in a run of spaces, counts as spacing, so
<p> </p>and<td> </td>spacers stop leaving lines that look blank. A single no-break space between two words is kept (#121)
Dependencies
- golang.org/x/net 0.61.0 (#113)
Full Changelog: v1.4.1...v1.4.2
v1.4.1
What's Changed
A huge colspan no longer exhausts memory.
Fixes
- Table spans are clamped to 1..1000, the HTML limit for colspan, so a value such as
colspan="9223372036854775807"can't make conversion append billions of cells (#117)
Full Changelog: v1.4.0...v1.4.1
v1.4.0
What's Changed
ConvertNode converts a document you've already parsed with html.Parse, so callers holding the tree skip a second parse.
New
ConvertNode(root *html.Node, opts ...Option)converts a parsed tree and leaves it unchanged.ConvertReadernow parses and calls it, so the two give the same output (#116)
Full Changelog: v1.3.0...v1.4.0
v1.3.0
What's Changed
Data tables are now laid out in columns, or as GFM tables with WithMarkdown, and Chinese, Japanese and Korean text wraps by display width. Alongside that, a round of rendering fixes.
Output changes
- Tables whose first row is all header cells line up in columns (#105)
- CJK text wraps between characters, and wide characters count as two columns for wrapping, heading rules and tables (#112)
<ol reversed>counts down, and<ol type>numbers with letters or roman numerals (#107, #108)<q>text is quoted, and<del>/<s>/<strike>text is wrapped in~~(#109, #110)- Button inputs show their label (#111)
javascript:links keep only their text (#102)- Repeated link targets reuse their footnote number (#103)
- Link text matching its target in another case collapses to the target (#104)
Fixes
- Styles marked
!importantare respected when hiding content (#99) - Zero width non-joiners inside Persian and Indic words are kept (#100)
- Heading rules are sized by characters rather than bytes (#101)
Other
- Less memory per conversion on most documents (#98)
- README shows decoding non-UTF-8 parts before
ConvertReader(#106)
Full Changelog: v1.2.0...v1.3.0
v1.2.0
What's Changed
Upgraded some dependencies, and added better controls for how we handle hidden content
Full Changelog: v1.1.0...v1.2.0
v1.1.0
What's Changed
Add support for markdown generation & performance fixes for WordWrap
Full Changelog: v1.0.0...v1.1.0
v1.0.0
What's Changed
First v1 release of the library, focus has been around locking in performance and matching other similar libraries, while improving handling of a variety of tags & data that commonly show up in emails.
Full Changelog: v0.4.0...v1.0.0