builds on per-doc routing: long docs (API reference has 6 sections, Roadmap 4) are now navigable and section-shareable. - each h2/h3 gets a slug id + a hover '#' anchor; URL form is #/<doc-slug>/<section-slug> (e.g. #/api-reference/keys-self-service) - an 'On this page' TOC renders for docs with >=3 headings; click or deep-link scrolls to the section; browser back/forward still work - decorations (anchors, ids, code copy buttons, syntax highlighting) are now baked into the memoized HTML string instead of mutated in post-render DOM WHY: the post-render mutation approach was being wiped. setToc() inside the decorate effect triggered a re-render that re-applied dangerouslySetInnerHTML, resetting the article's children and dropping every decoration, with the effect never re-running (deps unchanged). Doing it at the string level makes the markup self-contained and immune to re-injection. Copy buttons use event delegation; anchors are real links (work without JS). - verified live: 6/6 heading ids + anchors on API reference, TOC navigates, 3 copy buttons + highlighting on Connect-your-broker, deep-links land and scroll to the section, TOC hidden on short docs
19 lines
388 B
JSON
19 lines
388 B
JSON
{
|
|
"name": "amerc-site",
|
|
"version": "0.88.0-docsections",
|
|
"private": true,
|
|
"type": "module",
|
|
"scripts": {
|
|
"dev": "vite --host 0.0.0.0",
|
|
"build": "vite build",
|
|
"preview": "vite preview --host 0.0.0.0"
|
|
},
|
|
"dependencies": {
|
|
"@vitejs/plugin-react": "^5.0.0",
|
|
"marked": "^14.1.4",
|
|
"react": "^19.0.0",
|
|
"react-dom": "^19.0.0",
|
|
"vite": "^7.0.0"
|
|
}
|
|
}
|