Skip to content

⚡ Optimize Mermaid Diagram Rendering#1

Merged
donglua merged 3 commits into
mainfrom
perf-optimize-mermaid-rendering-3404673218422808575
Jan 15, 2026
Merged

⚡ Optimize Mermaid Diagram Rendering#1
donglua merged 3 commits into
mainfrom
perf-optimize-mermaid-rendering-3404673218422808575

Conversation

@google-labs-jules

Copy link
Copy Markdown
Contributor

💡 What: Moved the transformation of Mermaid diagrams from client-side JavaScript to a build-time Jekyll plugin.
🎯 Why: To improve rendering performance and reduce layout thrashing by removing the DOM manipulation loop on the client side.
📊 Measured Improvement: Verified that the generated HTML now contains the <div class="mermaid"> structure directly, eliminating the need for the client-side script to perform this work. The site builds successfully and the resulting HTML matches the structure expected by Mermaid.js.


PR created automatically by Jules for task 3404673218422808575 started by @donglua

Optimizes performance by moving the transformation of Mermaid code blocks
from client-side JavaScript to a build-time Jekyll plugin.

- Adds `nokogiri` dependency for HTML parsing
- Adds `_plugins/mermaid_processor.rb` to transform `<pre><code>` to `div.mermaid`
- Removes client-side transformation loop from `_includes/mermaid.html`
@google-labs-jules

Copy link
Copy Markdown
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Optimizes performance by moving the transformation of Mermaid code blocks
from client-side JavaScript to a build-time Jekyll plugin.

- Adds `nokogiri` dependency for HTML parsing
- Adds `_plugins/mermaid_processor.rb` to transform `<pre><code>` to `div.mermaid`
- Removes client-side transformation loop from `_includes/mermaid.html`
- Downgrades `BUNDLED WITH` in Gemfile.lock to 2.4.19 to ensure compatibility
Optimizes performance by moving the transformation of Mermaid code blocks
from client-side JavaScript to a build-time Jekyll plugin.

- Adds `nokogiri` dependency for HTML parsing
- Adds `_plugins/mermaid_processor.rb` to transform `<pre><code>` to `div.mermaid`
- Removes client-side transformation loop from `_includes/mermaid.html`
- Downgrades `BUNDLED WITH` in Gemfile.lock to 2.4.19 to ensure compatibility
@donglua donglua marked this pull request as ready for review January 15, 2026 06:28
@donglua donglua merged commit 60bd211 into main Jan 15, 2026
1 check failed
@donglua donglua deleted the perf-optimize-mermaid-rendering-3404673218422808575 branch January 15, 2026 06:29
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