diff --git a/IMPLEMENTATION_PLAN.md b/IMPLEMENTATION_PLAN.md index 75daf289..b540a995 100644 --- a/IMPLEMENTATION_PLAN.md +++ b/IMPLEMENTATION_PLAN.md @@ -2346,3 +2346,13 @@ Verification and scope: `docs/superpowers/plans/2026-10-30-drafts-conflicts-adap ## Remote MCP (2026-10-30) Implementation and validation ledger: [remote MCP plan](docs/superpowers/plans/2026-10-30-remote-mcp.md). Local stdio compatibility, shared operations, HTTP auth, packaging and docs are tracked there. Public HTTPS deployment and live Perplexity Pro smoke are separate acceptance steps. + +## Rendering polygon parity (2026-11-02) + +- [x] Import the vault note font size and match property presentation, partial list indentation, task ticks and inline-link geometry. +- [x] Preserve bounded inert HTML formatting; match code fences, display math, Mermaid colors and source-edit actions. +- [x] Keep embedded-note navigation and native missing-reference presentation; resolve same-note heading/block links and compact missing PDF embeds. +- [x] Match consecutive image spacing and use validated YouTube player settings for authored privacy-domain iframes while keeping other frames isolated. +- [x] Verify mouse hover, keyboard activation and unchanged note source against isolated native Obsidian fixtures; update the running server with backups and asset/runtime verification. + +Validation details and explicit browser/native limitations: [polygon parity](docs/superpowers/plans/2026-11-02-render-polygon-parity.md), [marker/media follow-up](docs/superpowers/plans/2026-11-02-marker-media-parity.md). The implementation passed 390 server tests (10 Windows skips), 517 web tests, typecheck, full build, local integration smoke and isolated Linux deployment smoke before the PR integration checks. Bases remain outside this parity pass. diff --git a/docs/superpowers/plans/2026-11-02-marker-media-parity.md b/docs/superpowers/plans/2026-11-02-marker-media-parity.md new file mode 100644 index 00000000..360907ff --- /dev/null +++ b/docs/superpowers/plans/2026-11-02-marker-media-parity.md @@ -0,0 +1,23 @@ +# Marker and media follow-up parity + +Scope: follow-up screenshots of heading hashes, inline code in callout titles, consecutive images, embedded-note open icon, repeated PDF instances and external HTML frames. Preserve note bytes and established embed interactions. + +Native evidence: isolated Obsidian 1.14.5 with copied polygon and attachments. Active heading hashes are text-faint (dark 102,102,102), callout title code is text-normal (dark 218,218,218). Consecutive 300px images touch exactly (first y250.046875 + height168.75 = second y418.796875). Single and combined page=3/rect PDF references show page3 with the page3 rectangle; raw rect does not introduce a crop in native. + +Root causes and fixes: +- Nested CodeMirror syntax highlighting painted heading hashes with its meta orange despite the outer formatting mark. Scope faint color to formatting-header descendants. +- Inline code inherited its callout title color; explicitly use text-normal, matching native code behavior. +- Live Preview image base theme added 6px top/bottom margins. Remove margins, align wrapper to top; adjacent rows have zero gap and an authored blank row remains visible. +- Authored YouTube iframe was treated as a generic opaque-origin frame. Canonicalize verified YouTube hosts/11-character IDs and reuse existing trusted player permissions/referrer policy. Support privacy-host embed URLs in both provider resolvers and preserve that host. Unknown frames remain opaque; all note-supplied privileged attributes are discarded. + +Confirmed browser boundary: obsidian.md sends X-Frame-Options SAMEORIGIN. Native app permits its loading; web styling cannot override that remote restriction. No proxy or framing-header bypass introduced. + +Unreproduced reports: native fresh same-file PDF refs render correct page3, whereas screenshot left shows page1 and right page3; requested which embed is pictured. Embedded-note icon has two complete arrows in both original screenshot and fresh pixel crop, independently reviewed. SVG geometry, four-corner hit-testing, quoted blocks at 12/16/19px, wide editor/outline and three modes pass; no speculative icon or PDF runtime modification. + +Checks: failing tests recorded before marker/image/YouTube fixes; focused browser tests pass. Real headless Chrome A/B shows old policy black, new policy native-equivalent unavailable-video message. Typecheck/build/integration pass. Independent review found no material issue in provider trust boundaries or style changes. Final full regression and deployment results are recorded with the release. + +Final pre-deployment regression: 390 server tests passed (10 Windows skips), 517 web tests passed, 907 total passing; no failures. Typecheck, full build and local integration smoke passed. + +Post-package record: full copied native polygon was also opened at its exact third PDF source line (page=3&rect); page3 rectangle and footer rendered. No code change needed. Deployed marker-media-b093484ffadd with backup /opt/webobsidian/backups/marker-media-b093484ffadd-20261102T062541Z; HTTPS plus seven asset hashes and both module hashes verified, YouTube policy verified inside running container, original note and fixtures unchanged. + +Pre-merge review caught an additional code-fence edge case: a longer outer fence can contain literal shorter fences, and an unclosed block has no closing delimiter. Use the syntax node's CodeMark boundaries for concealment rather than a line-prefix regex. A real browser regression fails before the fix and passes afterward for backticks, tildes and unclosed blocks in both Live and Reading, with unchanged source. This correction is additional to the deployed marker/media snapshot. diff --git a/docs/superpowers/plans/2026-11-02-render-polygon-parity.md b/docs/superpowers/plans/2026-11-02-render-polygon-parity.md new file mode 100644 index 00000000..fee7fd42 --- /dev/null +++ b/docs/superpowers/plans/2026-11-02-render-polygon-parity.md @@ -0,0 +1,48 @@ +# Rendering polygon parity + +**Goal:** Match the user's rendering test page against native Obsidian 1.14.5 while preserving note bytes. + +**Observed:** Native uses `.obsidian/appearance.json` baseFontSize 19, while the web default remains 16. Native preserves mixed inline color/weight, bounded padding/radius, legacy font color and custom mark colors; the current whole-style regex discards them. Native kbd has a visible keyboard-key shape. Sub/sup shorthand and backslash-parenthesized math remain literal in native, so they must not be invented as supported features. + +**Design:** Read typed appearance font size through existing vault preferences, apply only to note text and public content, and remeasure the editor on preference changes. Normalize a small inert inline CSS allowlist before the shared HTML sanitizer; preserve legacy color visually without allowing arbitrary style, URLs or event attributes. Add scoped kbd styling. Match native callout title line height (1.3) and paragraph margins (1em); the measured 19px single-paragraph box is 115.2px rather than the current 81px Live box. Other page sections are compared using native and browser captures; missing references are compared as missing; later, the user explicitly authorized creating test attachments without overwriting existing notes. Native captures use a copied fixture and a fresh profile. Native MathJax uses 19px for inline and display math at 19px note text; scope KaTeX to 1em to remove its extra default 1.21x scaling. Browser fixtures must include a doctype; quirks mode disables KaTeX and alters table inheritance. + +- [x] Capture native/browser results for the user-provided test source. +- [x] Add failing appearance and inline HTML parity tests, including unsafe CSS and outside-vault configuration guards. +- [x] Implement font-size import, scoped note typography and safe inline HTML formatting. +- [x] Verify real Live/Reading/Preview computed styles, editable-source actions and unchanged source; rerun full regressions/builds and independent review. +- [x] Update the running server with backup and verify external/runtime hashes. + +Validation: 385 server tests passed (10 Windows skips), 514 web tests passed; final focused typography/math and renderer-security checks passed (11). Typecheck, full build and integration smoke passed. Native/browser captures compare all eleven sections; note source hashes remain unchanged. Reviewer approved inline CSS, appearance boundaries and callout folding scope. + +Deployed: `render-polygon-004c430aa93a`; backup `/opt/webobsidian/backups/render-polygon-004c430aa93a-20261101T214149Z`. External HTTPS and 7 assets verified; all 4 server runtime hashes match the release. Live vault font is 19 from Obsidian; original polygon SHA-256 unchanged; settings unchanged. + + +## Second pass: reported differences and loaded attachments + +Native reference: isolated Obsidian 1.14.5 vault, original polygon copied without edits, 19px note font. Browser references: real Editor Live/Reading and Preview, all eleven sections. Keep Bases out of scope. + +- [x] Native property icons, metadata font/row scale, plain alias/cssclass values, idle date/number fields. +- [x] Partial two-space list indentation vs full four-space indentation; native dark checkbox tick. +- [x] Reset inline widget hanging indent; real click and keyboard link activation. +- [x] Callout fold arrow after title; full callout source action and unboxed raw quote editing. +- [x] Multiline display math independent of viewport parsing; source actions for math/Mermaid. +- [x] Late code fences use complete literal ranges; hidden fences add no empty rows; native language casing and right-aligned flair. +- [x] Native Mermaid palette from installed reference initialization/styles; muted Live footnote markers. +- [x] Empty/missing note embeds retain native title, accent border and open button; compact quote spacing. +- [x] Same-note fragment resolution handles heading/block links through the actual server resolver. +- [x] Genuine PDF 404 collapses to native missing-file placeholder, with complete fragment label. +- [x] Review-discovered Math source button Enter interception reproduced and fixed with real CDP keyboard input. +- [x] Generate four attachments (PNG, MP3, MP4, seven-page PDF), inspect all PDF pages, load copied fixtures in native and browser. Preserve existing root notes. +- [x] Native audio full note width and 42px height; deterministic WebM fixture removes MediaRecorder/GPU test flakiness without dropping playback checks. +- [x] Verify callout source button hovering body/title/away, math/Mermaid/PDF hover buttons and loaded attachment actions. +- [x] Complete final full tests/typecheck/build/integration and review, install absent test attachments exclusively, deploy with backup, verify runtime/assets and unchanged user note bytes. + +Browser test fixture `tests/fixtures/embeds/clip.webm` is generated from FFmpeg's synthetic testsrc (240x120, 10fps, 0.6s, libvpx yuv420p). No external/user media; fetched through the existing blob-store test route and still checked for nonzero duration and working play/pause. + + +Second-pass validation before deployment: 386 server tests passed (10 Windows skips), all 515 web tests passed, full typecheck/build and cross-platform integration smoke passed. Real CDP mouse hovering title/body/away and math/Mermaid blocks, keyboard Enter, loaded media play/pause and source preservation verified. Native vs loaded browser image sizes agree (640x360, 300x168.75, 300x150); native audio is full column width/42px, video is 640x360; note titles 19px/28.5px and open controls 24px. PDF full/page=3/rect references load seven-page document, page is correct and viewer height tracks page. Native rect reference behaves like page=3 too; no new rect semantics introduced. All seven authored PDF pages visually inspected. Reviewer rechecked hover cleanup, source-button keyboard isolation and scoped media styles: no material findings. + +Deployment uses current render-polygon image as immutable base; only services/fileReferences.js and services/markdownContext.js differ semantically on the server. Other changed server source in this working tree was already included in the preceding release. Source package includes all current worktree changes; test fixture installation has exclusive create/no overwrite and protected source hashes. + + +Post-deployment record (documentation updated after packaging): `polygon-details-82dcfb595877`, image `sha256:9377d1be410374bc94c122b11dcd3d176a8a8c5e01baa8d0cbf69a6ca28ce4f9`; backup `/opt/webobsidian/backups/polygon-details-82dcfb595877-20261101T230342Z`. HTTPS health and seven assets verified, both new runtime module hashes match. Installed four fixtures under `Тесты/Attachments` without overwrites; production resolver resolves all four and same-note block correctly. Polygon SHA remains `7c02fe81836f071ee0e9648b9225f21eb37d8f7da14dd9d8f7787971b33c4658`; both existing linked note hashes and app settings unchanged. Deployment's isolated Linux integration smoke passed too. diff --git a/scripts/integration-smoke.mjs b/scripts/integration-smoke.mjs index b6b08437..5fc61f9b 100644 --- a/scripts/integration-smoke.mjs +++ b/scripts/integration-smoke.mjs @@ -89,6 +89,10 @@ try { assert.equal(resolved.path, 'notes/attachments/document.pdf'); const localNote = await (await request('/api/resolve?target=neighbor&from=notes/editable.md')).json(); assert.equal(localNote.path, 'notes/neighbor.md', 'note embeds resolve beside their source before basename fallback'); + for(const target of ['#^quote-block-target','#11. Section']){ + const self=await(await request('/api/resolve?target='+encodeURIComponent(target)+'&from=notes/editable.md')).json(); + assert.equal(self.path,'notes/editable.md','fragment-only links retain the actual current note identity'); + } const secondNote = await (await request('/api/resolve?target=neighbor&from=second/root.md')).json(); assert.equal(secondNote.path, 'second/neighbor.md'); const document = await request(relative); diff --git a/server/src/routes/publicEmbeds.test.ts b/server/src/routes/publicEmbeds.test.ts index c2c23cca..731b95c2 100644 --- a/server/src/routes/publicEmbeds.test.ts +++ b/server/src/routes/publicEmbeds.test.ts @@ -13,6 +13,7 @@ vi.mock('../services/vault.js',()=>({exists:async(p:string)=>fixture.files.has(p vi.mock('../services/shares.js',()=>({getActiveShare:async(id:string)=>fixture.enabled&&id==='token'?{id,path:'Folder/Host.md',enabled:true,...(fixture.locked?{passwordHash:'protected'}:{})}:fixture.children.find(s=>s.id===id&&s.enabled)??null,listShares:async()=>[{id:'token',path:'Folder/Host.md',enabled:fixture.enabled,createdAt:'fixture',...(fixture.locked?{passwordHash:'protected'}:{})},...fixture.children]})); vi.mock('../services/fileindex.js',()=>({resolveFile:()=>null,indexedFilePaths:()=>[...fixture.files.keys()]})); vi.mock('../services/linkpreview.js',()=>({embedLinkPreviews:async(html:string)=>html})); +vi.mock('../services/vaultPreferences.js',()=>({getVaultPreferences:async()=>({values:{baseFontSize:19}})})); import {sharePageRouter} from './sharepage.js'; let server:Server,base:string; @@ -28,6 +29,7 @@ it('adds a separate read-only module while retaining SSR PDF and Canvas fallback const r=await fetch(base+'/share/token');const html=await r.text();expect(r.status).toBe(200); expect(html).toMatch(/type="module"[^>]+src="\/assets\/public-embeds-test.js"/); expect(html).toContain('data-public-share="token"'); + expect(html).toContain('--font-text-size:19px'); expect(html).toContain('class="pdf-embed"');expect(html).toContain('class="canvas-embed"'); expect(html).not.toContain('/api/files'); }); diff --git a/server/src/routes/sharepage.ts b/server/src/routes/sharepage.ts index 23610125..b1f09fdd 100644 --- a/server/src/routes/sharepage.ts +++ b/server/src/routes/sharepage.ts @@ -16,6 +16,7 @@ import {renderPublicCanvasHtml} from '../services/publicCanvasRendering.js'; import { embedLinkPreviews } from '../services/linkpreview.js'; import { publicMarkdownScript } from '../services/publicMarkdown.js'; import { canvasDescription, canvasFirstImage, canvasViewerScript } from '../services/rendercanvas.js'; +import {getVaultPreferences} from '../services/vaultPreferences.js'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); @@ -58,6 +59,7 @@ function page(opts: { /** Skip the narrow markdown-preview column (used by the full-width canvas view). */ bare?: boolean; shareId?:string; + baseFontSize?:number; }): string { const inner = opts.bare ? opts.body @@ -76,7 +78,7 @@ ${opts.body} ${opts.head ?? ''}
-