You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This Pull Request introduces native support for parsing, rendering, and exporting ABC Music Notation inside markdown documents (using fenced ```abc blocks). In addition, it secures the application against CVE-2024-13551 (Stored XSS) and resolves a critical build pipeline bug in the Neutralino desktop environment where lazy-loaded libraries were left un-packaged during offline compiles.
Key Features & Implementations
1. Fenced Code Block Tokenizer & Compiler
Intercepts language === "abc" blocks in both the Web Worker (preview-worker.js) and the main-thread fallback compiler (script.js).
Generates lightweight container placeholders to keep parsing threads fast and responsive.
2. Viewport-Driven & Batch Rendering
Integrated IntersectionObserver in the post-processing lifecycle to only invoke abcjs layout calculations when a stave scrolls into view.
Leverages progressive batch yielding (setTimeout(..., 0)) to yield execution back to the browser's paint loop, protecting scroll performance on larger files.
Inherits the FNV-1a block hashing cache system to prevent unmodified ABC blocks from executing redundant renders.
3. Pure CSS Theme Adaptation
Configured abcjs options with { add_classes: true } and added stroke/fill mappings using CSS variable currentColor inside styles.css.
Staff lines, clefs, note heads, and stems invert instantly at 60fps when dark mode is toggled, without executing any JavaScript.
4. Screen Reader Accessibility
Silenced visual SVG paths for screen readers by adding role="img" to the root <svg>.
Dynamically extracts tune metadata (T: Title, C: Composer, K: Key, M: Meter) to inject <title> and <desc> tags linked via aria-labelledby.
Appends visually hidden raw ABC code wrappers (.abc-sr-only) linked via aria-describedby for blind musicians.
Created a keyboard-accessible toolbar above staves with a toggle button (aria-pressed) to switch between the sheet music and raw code text.
Secured metadata annotations against script injections by running DOMPurify on the container after the SVG output is written.
Whitelisted role, aria-labelledby, and aria-describedby inside the PREVIEW_SANITIZE_OPTIONS dictionary.
6. Export Functionality
HTML Export: Automatically packages abcjs lazy-loaders and loads rendering hooks on document launch.
PDF Export: Pre-renders the ABC sheets in the print sandbox and converts the resulting SVGs to Base64 <img> tags, allowing html2canvas and jsPDF to compile and paginate staves without clipping or rendering artifacts.
7. Desktop Offline Assets Fix
Resolved a defect in desktop-app/prepare.js where dynamic libraries (mermaid, MathJax, jsPDF, html2canvas, pako, joypixels, and abcjs) were omitted from offline compilation.
Upgraded checksum verification to support cdnjs sha512 integrity hashes and bundled all assets locally inside /libs/ for 100% offline desktop execution.
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.
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
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
This Pull Request introduces native support for parsing, rendering, and exporting ABC Music Notation inside markdown documents (using fenced
```abcblocks). In addition, it secures the application against CVE-2024-13551 (Stored XSS) and resolves a critical build pipeline bug in the Neutralino desktop environment where lazy-loaded libraries were left un-packaged during offline compiles.Key Features & Implementations
1. Fenced Code Block Tokenizer & Compiler
language === "abc"blocks in both the Web Worker (preview-worker.js) and the main-thread fallback compiler (script.js).2. Viewport-Driven & Batch Rendering
IntersectionObserverin the post-processing lifecycle to only invokeabcjslayout calculations when a stave scrolls into view.setTimeout(..., 0)) to yield execution back to the browser's paint loop, protecting scroll performance on larger files.3. Pure CSS Theme Adaptation
abcjsoptions with{ add_classes: true }and added stroke/fill mappings using CSS variablecurrentColorinsidestyles.css.4. Screen Reader Accessibility
role="img"to the root<svg>.T: Title,C: Composer,K: Key,M: Meter) to inject<title>and<desc>tags linked viaaria-labelledby..abc-sr-only) linked viaaria-describedbyfor blind musicians.aria-pressed) to switch between the sheet music and raw code text.5. Stored XSS Mitigation (CVE-2024-13551)
DOMPurifyon the container after the SVG output is written.role,aria-labelledby, andaria-describedbyinside thePREVIEW_SANITIZE_OPTIONSdictionary.6. Export Functionality
abcjslazy-loaders and loads rendering hooks on document launch.<img>tags, allowinghtml2canvasandjsPDFto compile and paginate staves without clipping or rendering artifacts.7. Desktop Offline Assets Fix
desktop-app/prepare.jswhere dynamic libraries (mermaid,MathJax,jsPDF,html2canvas,pako,joypixels, andabcjs) were omitted from offline compilation.sha512integrity hashes and bundled all assets locally inside/libs/for 100% offline desktop execution.