Repository navigation
feat(code-snippets): add syntax-highlighted reveal and token morph animations - #1
Merged
Merged
Conversation
Member
Author
|
Review (Claude, orchestrator): MERGE after CI. Looked at the re-rendered morph frames (25/50/75/100%): phases now overlap like Shiki Magic Move, matched tokens move instead of fading, no empty mid-frame; reveal frames fine. Licenses: Shiki Magic Move (MIT, behaviour port, credited), JetBrains Mono (OFL, included), syntect (MIT, included). Package 776 KiB. |
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.
Code Snippets adds a community clip-source plugin for animated code in AniMathIO 2: syntax coloring for Rust, Python, JavaScript, TypeScript, C/C++, JSON, TeX and Bash; three dark/light themes; line numbers and line emphasis; a padded rounded panel; and a keyframable
progressfor character/line reveal or token morphing.This is a behavioral port of Anthony Fu's Shiki Magic Move (MIT), studied at v1.1.0: matching tokens move, removed and entering tokens fade in overlapping windows. The Rust implementation uses bounded token LCS with integer comparisons and one-to-one moved-token matching. No upstream animation code or external grammar is copied. README and NOTICE credit the project and retain its license. Unmodified JetBrains Mono 2.304 is embedded because ABI 1.1's host text import only offers DejaVu Sans; the font's OFL 1.1 license is included in both source and bundle.
Syntect uses the pure Rust fancy-regex backend and nine small original lexical grammars compiled into a dump at build time. Each render derives its scene solely from evaluated params; glyph caches live only within that call. The bundle is 795,124 bytes (777 KiB), with a 2,396,212-byte component. No capabilities or host services are requested. CI builds/tests the plugin alongside the examples, runs the released-host test, and uploads the bundles. The community table links its source and CI.
Validation completed locally:
cargo fmt --all --check, nativecargo clippy --workspace --all-targets --locked -- -D warnings, WASI clippy, andcargo test --workspace --lockedfor the standalone plugin workspace: nine unit tests and one generated binding doctest pass.wasm32-wasip2release build and.ampluginpackaging.cce18dd8215aa9c23ba7c5756e6c0785c1931dd027aadf31a7bbbf3b92fac6ec, extracted it with--appimage-extract, and confirmedanimathio-cli 2.1.0.smoke.py: reveal and morph at 0/25/50/75/100%, exact endpoints, repeated calls, actual examples in every language, themes/line selection/no-panel variants, and a host-sampled typed progress keyframe at 0.5 seconds. A 256-token-per-side morph and 1,024-character comment also pass with the default sandbox limits. The smoke rejects error placeholder pixels even when the CLI exits successfully.community/code-snippets/screenshots/{reveal,morph}-{000,025,050,075,100}.png.V1 limits are explicit: lexical highlighting rather than full language parsing (e.g. nested Rust block comments, JS interpolation and shell heredocs are deferred), one cell per Unicode scalar, 1,024 characters / 256 tokens / 80 lines per snippet, and no custom fonts/themes, selection rectangles or multi-step transitions. GUI interaction was not tested; all host checks used the headless released CLI with audio disabled. No desktop windows or audio devices were opened. This PR must not be merged as part of this task.
Review correction: exits fade across 0–60%, retained tokens ease across 15–85%, and entries fade across 40–100%. Read upstream 1.1.0 renderer/CSS defaults (500 ms, stagger 0, full-duration overlapping transitions); README documents the normalized adaptation. All identical token text, including short identifiers and punctuation outside the LCS, is now paired one-to-one. Midpoint alpha and short-token coverage regressions pass. Rust keyword scopes already yield Ocean purple for fn/let/mut/for/in; explicit regression coverage and visually checked endpoint confirm this. Nothing further deferred by this correction.