Skip to content

Fix blank Markdown previews from search results - #3439

Open
seyeeL wants to merge 1 commit into
Automattic:trunkfrom
seyeeL:seyeeL/fix-markdown-preview-search
Open

seyeeL wants to merge 1 commit into
Automattic:trunkfrom
seyeeL:seyeeL/fix-markdown-preview-search

Conversation

@seyeeL

@seyeeL seyeeL commented Aug 30, 2026

Copy link
Copy Markdown

Fix

Fixes #3364.

Markdown previews could render as a blank note when a search query was active. The preview is rendered into a detached element, but the search-highlighting TreeWalker started from its root element and treated that root as a text node. This caused a null parentNode error before the rendered content could be copied back into the visible preview.

Start the traversal at the first matching text node instead, and add a regression test covering search highlighting in a detached render target.

Forum report: https://forums.simplenote.com/forums/topic/markdown-preview-broken-during-find/#post-6679

Test

Reviewer reproduction:

  1. Enable Markdown for a note containing a searchable term.
  2. Search for that term and open the note from the search results.
  3. Switch to Markdown preview and confirm the rendered note remains visible with the match highlighted.

Automated verification performed:

  • npx jest --config=./jest.config.js lib/note-detail/render-to-node.test.ts --runInBand
  • npm test — 24/24 suites passed; 168 tests passed and 1 skipped
  • npm run lint — completed with 0 errors (32 existing warnings)

Release

RELEASE-NOTES.md was updated with:

Fixed Markdown previews appearing blank when viewing notes from search results

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.

Markdown preview issue in 2.25.0 / 2.26.0 / 2.27.1

1 participant