Skip to content

fix(html-email-formatter): drop the unmaintained pretty package - #68

Merged
avigoldman merged 2 commits into
mainfrom
html-email-formatter-drop-pretty
Nov 11, 2026
Merged

avigoldman merged 2 commits into
mainfrom
html-email-formatter-drop-pretty

Conversation

@avigoldman

@avigoldman avigoldman commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

html-email-formatter now calls js-beautify directly instead of going through pretty. Output is unchanged.

pretty hasn't had a release since 2017, and it pulls in condense-newlines, extend-shallow, is-whitespace, kind-of and is-buffer. This package now does the small part of pretty it used:

  • Defaults: 2-space indent, indent_inner_html, and code/pre/em/strong/span left unformatted. Options still override them.
  • The ocd pass, copied as written. pretty's is-whitespace counts " and U+180E as whitespace, so a line of indentation plus " still gets trimmed, and an empty newlines still falls back to \n.
  • EmailFormatterOptions replaces Parameters<typeof pretty>[1] & HTMLBeautifyOptions. It only widens: ocd is now optional.

pretty also passed condense-newlines options such as sep, min and keepWhitespace through to the ocd pass. The types never allowed them, and they're now ignored. Every known caller passes ocd: false: hydra's editor and language worker, and parcel's process-pipeline.

js-beautify stays on ~1.13.4. #37 pinned it there for parity with parcel-standalone, and 1.15 changes the output on at least one standard component's <script>.

Verification

  • Fixtures: 167 HTML files from parcel and hydra (Carta standard components, email fixtures, Design Studio templates), each run with 4 option sets: hydra's editor options, process-pipeline's tabs with force-expand-multiline, no options, and ocd: true. All 668 outputs are byte-identical to 0.0.5.
  • Fuzz review: a separate review fuzzed 3000 email-like fragments across 5 option sets against the published 0.0.5. All 15000 matched.
  • Packed tarball: the review also checked that it works from both require and import, and typechecks under nodenext and node10.
  • Tests: all 7 pass, including the property tests and a new test for the empty-newlines fallback. Lint, Prettier and the typecheck are clean.

@changeset-bot

changeset-bot Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6690c6e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@ciolabs/html-email-formatter Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@avigoldman avigoldman changed the title fix(html-email-formatter): drop pretty and move to js-beautify 1.15 fix(html-email-formatter): drop the unmaintained pretty package Nov 11, 2026
@avigoldman
avigoldman merged commit 7c02021 into main Nov 11, 2026
3 checks passed
@avigoldman
avigoldman deleted the html-email-formatter-drop-pretty branch November 11, 2026 04:18
@github-actions github-actions Bot mentioned this pull request Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant