Skip to content

fix(zotero): preserve Unicode quote ranges - #102

Draft
Ricardo-M-L wants to merge 1 commit into
zai-org:mainfrom
Ricardo-M-L:fix/zotero-unicode-quote-ranges
Draft

Ricardo-M-L wants to merge 1 commit into
zai-org:mainfrom
Ricardo-M-L:fix/zotero-unicode-quote-ranges

Conversation

@Ricardo-M-L

Copy link
Copy Markdown

Plugin type (required)

  • UI Plugin
  • Standard plugin
  • Not applicable

Affected plugin name: zotero

What

Fix PDF quote matching and highlight ranges for supplementary-plane mathematical characters and combining sequences. Currently The equation 𝑥 = 1 follows. does not match x = 1: NFKC is applied to half of each UTF-16 surrogate pair. The previous end-offset calculation can also truncate the original character.

  • Preserve complete original grapheme ranges while applying whitespace/character folding and compatibility decomposition.
  • Recompose at the transformed text boundaries so removed zero-width characters, compact whitespace, and compatibility Hangul do not break matching.
  • Map each normalized UTF-16 unit to both original start and end positions; highlights retain entire surrogate pairs, ligatures and combining sequences.
  • Bump manifest, marketplace, source package and protocol versions from 0.1.0 to 0.1.1, with equivalent English/Chinese documentation.

No new dependencies, permissions, network services or changes to write authorization. Tests use isolated fake Zotero data; no real user library was read or modified. No generated distributions are committed.

Verification

  • Plugin tests: 101 passed, including the mathematical alphanumeric Unicode block, surrogate/emoji offsets, ligatures, accents, compact/zero-width folding, compatibility Hangul, repeated searches and exact highlight rectangles.
  • A generated ToUnicode PDF is parsed by the production pdf.js pipeline; searching x = 1 finds the original 𝑥 = 1 text and maps the complete glyph.
  • MCP integration checks find_in_pdf → highlight → save_highlights → resource read-back against isolated fake Zotero and a real PDF.
  • Built stdio MCP server smoke against isolated fake Zotero: passed.
  • Plugin build, package/root typecheck, touched-directory lint and git diff --check: passed.
  • Root validator: 45 plugins validated. Python suite: 130 passed, 19 skipped.

Outstanding / draft boundary

This is a draft pending full repository packaging and real ZCode Desktop + Zotero installation verification. Full pnpm build stops in the unrelated photocraft snapshot build because the pinned Rust WASM target / Trunk toolchain is missing; consequently build_dist.py rejects the incomplete build. No build checks were bypassed. No real Zotero application is installed on this test machine, and Desktop installation verification is not claimed.

Root pnpm test passed in an earlier run. A subsequent run encountered the untouched Typst notification-count timing test (test/tools.test.ts:151, expected at least 4 notifications, received 3); that file passed all 14 tests when rerun independently. The failed full run is not hidden as a successful run.

Self-check

  • Existing plugin ownership retained; only this plugin and its marketplace version changed
  • Plugin type and name declared
  • Immutable installable-content version bumped consistently
  • Equivalent English / Chinese README update
  • No secrets, private endpoints, machine paths, or generated artifacts
  • Existing dependencies and side effects unchanged
  • Validator passes
  • Full root build and build_dist pass
  • Installed and exercised in ZCode Desktop + real Zotero

This branch has not been deployed

No deployments
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.

1 participant