{{ message }}
Repository navigation
refactor(website): simplify docs subtree (palette / sidebar / markdown / nav) - #4349
Merged
Merged
Conversation
…n / nav)
- CommandPalette: drop hitsRef/selectedRef mirroring, fix O(n²) hits.indexOf
by attaching the original index in groupHits, and escape page.hint —
only body-match snippets carry HTML.
- docs-search: cache lowercased title/group/hint/body/headings per page in
a WeakMap so scorePage stops lowercasing the same fields every keystroke.
- SidebarContext: lift the open/closed flag into DocsChrome and consume it
from DocsSidebar + SidebarToggle, dropping the
document.getElementById('docSide') reach-in and the unused onNavigate prop.
- DocsChrome: remove the document.body.classList side-effect; the .docs
class now lives on a server-rendered wrapper, with docs.css updated to
match.
- docs-nav: introduce PAGE_BY_KEY map; findPageBySlug and neighborsFor
become O(1) lookups instead of repeated slug.join scans.
- markdown.ts: type AlertKind ('note'|'tip'|'warn') and replace the
three-level ternary on the callout SVG path with an ALERT_ICON_PATHS
table; skip rewriteHref / 'link' class on the rehype-autolink-headings
anchor so its href stays untouched.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Contributor
|
Build artifacts for PR #4349: Run: https://github.com/marktext/marktext/actions/runs/26832194530 |
thimbleberrysystems
pushed a commit
to thimbleberrysystems/WordBird
that referenced
this pull request
Jun 21, 2026
…n / nav) (marktext#4349) - CommandPalette: drop hitsRef/selectedRef mirroring, fix O(n²) hits.indexOf by attaching the original index in groupHits, and escape page.hint — only body-match snippets carry HTML. - docs-search: cache lowercased title/group/hint/body/headings per page in a WeakMap so scorePage stops lowercasing the same fields every keystroke. - SidebarContext: lift the open/closed flag into DocsChrome and consume it from DocsSidebar + SidebarToggle, dropping the document.getElementById('docSide') reach-in and the unused onNavigate prop. - DocsChrome: remove the document.body.classList side-effect; the .docs class now lives on a server-rendered wrapper, with docs.css updated to match. - docs-nav: introduce PAGE_BY_KEY map; findPageBySlug and neighborsFor become O(1) lookups instead of repeated slug.join scans. - markdown.ts: type AlertKind ('note'|'tip'|'warn') and replace the three-level ternary on the callout SVG path with an ALERT_ICON_PATHS table; skip rewriteHref / 'link' class on the rehype-autolink-headings anchor so its href stays untouched. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Internal cleanups to the
/docssubtree. No behavior changes for readers — keyboard shortcuts, navigation, search, the sidebar collapse, and rendered output are all the same. Smaller bundle / fewer surprises for editors.hitsRef/selectedRef"mirror state into a ref" pattern; the keydown handler readshitsandsetSelected((s) => …)directly. Fix the O(n²)hits.indexOf(hit)inside the group render by attaching the original index ingroupHits. Escapepage.hint— only body-match snippets carry HTML; everything else renders as text.title/group/hint/body/headingsper page in aWeakMap, soscorePagestops re-lowercasing the same fields on every keystroke.sidebarOpen/setSidebarOpenintoDocsChromeand consume it fromDocsSidebar+SidebarToggle. Drops thedocument.getElementById('docSide')reach-in (and the unusedonNavigateprop).document.body.classList.add('docs')side effect; the.docsclass now lives on a server-rendered wrapper.docs.cssupdated to match (body.docs→.docs).PAGE_BY_KEYonce at module load;findPageBySlugandneighborsForare O(1) lookups instead ofslug.join('/')scans on every call.type AlertKind = 'note' | 'tip' | 'warn', plus anALERT_ICON_PATHSlookup table that replaces the three-level ternary incalloutIcon. SkiprewriteHref+linkclass on the rehype-autolink-headings anchor so its#idhref stays untouched.Test plan
pnpm --filter marktext-website type-checkpnpm --filter marktext-website lintpnpm --filter marktext-website build(37 static pages, no runtime errors)🤖 Generated with Claude Code