Skip to content

feat: render safe raw HTML in the editor - #493

Merged
Azganoth merged 2 commits into
mainfrom
feature/safe-raw-html
Sep 22, 2026
Merged

Azganoth merged 2 commits into
mainfrom
feature/safe-raw-html

Conversation

@Azganoth

Copy link
Copy Markdown
Owner

Summary

  • Render complete, attribute-free raw HTML from the accepted allowlist while preserving the authored token as the serialization source of truth.
  • Replace the detached HTML input with shared in-document source projection, including multiline editing, history/save finalization, and caret placement at the rendered position that was clicked.
  • Keep incomplete, unsupported, and separately tokenized HTML as layout-neutral muted source, and give live block HTML ordinary whitespace and block flow.

Related Issue

Closes #62

Verification

  • pnpm exec vitest run src/features/editor/utils/safeHtml.test.ts src/features/editor/tests/sourceProjectionHtml.test.ts src/features/editor/tests/htmlSafety.test.tsx src/features/editor/tests/editorPresentation.test.ts verifies the render predicate, security fallback, exact source-position mapping, projection behavior, and presentation rules.
  • pnpm check:frontend verifies formatting, TypeScript, lint, the production build, and the complete frontend test suite with coverage.

Not verified: the desktop E2E suite was not run locally; CI will exercise the updated WebView scenario.

Notes

The source-located parse constructs the validated DOM through element and text-node primitives instead of adopting a browser-parsed template. This differs mechanically from the spike prototype while retaining its security boundary: no HTML string is reparsed into the document and rejected trees are never partially sanitized. Retained source locations provide exact rendered-click mapping back to authored offsets.

@Azganoth Azganoth added the Feature New feature or request label Sep 21, 2026
@Azganoth Azganoth self-assigned this Sep 21, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in Leafdown Sep 21, 2026
@Azganoth
Azganoth enabled auto-merge (squash) September 21, 2026 23:16
@Azganoth
Azganoth force-pushed the feature/safe-raw-html branch from 1097d02 to f8913a9 Compare September 22, 2026 00:10
@Azganoth
Azganoth merged commit 02980ee into main Sep 22, 2026
3 checks passed
@Azganoth
Azganoth deleted the feature/safe-raw-html branch September 22, 2026 00:16
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Leafdown Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Render safe raw HTML live in the editor

1 participant