Skip to content

fix(import): preserve preformatted text node newlines - #270

Merged
DavidBabinec merged 1 commit into
mainfrom
fix/html-import-preserve-bare-newlines
Jul 25, 2026
Merged

fix(import): preserve preformatted text node newlines#270
DavidBabinec merged 1 commit into
mainfrom
fix/html-import-preserve-bare-newlines

Conversation

@DavidBabinec

Copy link
Copy Markdown
Contributor

What changed

  • Preserve literal whitespace for no-wrapper base.text nodes in both publisher output and the editor canvas.
  • Keep authored hard line breaks unchanged for semantic text elements such as headings and paragraphs.
  • Add regression coverage for <pre><code> imports and document the whitespace-preservation contract.

Why

Super Import correctly stored significant newlines inside <pre>, but the shared text renderer published those no-wrapper newline nodes as <br> elements. Typewriter scripts that snapshot code.childNodes then saw empty element segments; reading past those segments produced the literal text undefined throughout imported terminal/code animations.

Impact

Imported preformatted blocks retain the source DOM text-node shape, so runtime scripts can safely inspect and animate them. Existing imported sites only need to be republished after upgrading; no re-import is required.

Verification

  • bun test — 6,281 passed
  • bun run lint
  • bun run build
  • bun run doctor — completed with the repository's existing warning baseline

@DavidBabinec
DavidBabinec merged commit 8d22eee into main Jul 25, 2026
9 checks passed
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