Update dependency vitepress-mermaid-renderer to v1.1.26#157
Merged
Conversation
5e8a18f to
ede9742
Compare
KeeTraxx
approved these changes
Jun 2, 2026
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.
This PR contains the following updates:
1.1.24→1.1.26Release Notes
sametcn99/vitepress-mermaid-renderer (vitepress-mermaid-renderer)
v1.1.26Compare Source
v1.1.25Compare Source
Changed
securityLeveldefault changed from'loose'to'strict'.Inline HTML inside Mermaid diagrams is now disabled by default to prevent XSS
when rendering user-controlled or external Markdown content. If you need
inline HTML features (e.g. clickable links in flowchart nodes), opt in
explicitly:
createMermaidRenderer({ securityLevel: 'loose' }).getElementsByClassName+ fallbackquerySelectorAll('pre')scan with asingle
querySelectorAll('pre > code.mermaid, pre > code.language-mermaid')selector, eliminating the full-page
<pre>iteration and the customHTMLCollectionOfshim.renderWithRetry()now stops theexponential-backoff loop immediately when the
MutationObserveris active,since it will pick up any late-arriving Mermaid blocks. Reduced
maxRenderAttemptsfrom 15 to 5 accordingly.no longer rendered immediately; they are observed with an
IntersectionObserver(200 px root margin) and enqueued only when they scrollnear the viewport, significantly reducing initial page-load cost on long
documents.
requestAnimationFrameinstead of fixed delays — replaced thesetTimeout(resolve, 200)delay inrenderMermaidDiagram()and the 150 ms /50 ms production/cap delays in
useMermaidRendererwithrequestAnimationFrame-based paint waits, ensuring the SVG is settled withoutarbitrary timing guesses.
MutationObserverscoped toattributes: false— the DOM observer nowexplicitly opts out of attribute-change notifications, reducing unnecessary
callback invocations for style/class mutations unrelated to Mermaid content.
<pre>elements are immediatelymarked with
data-mermaid-processedso that concurrentMutationObservertriggers and retry passes cannot re-queue the same element.
createApp().mount()withrender(h(MermaidDiagram), wrapper). Each diagramnow mounts into a lightweight render call instead of creating a full Vue app
instance, reducing memory pressure on pages with many diagrams.
into
useFullscreenManager.ts. Instead of each diagram registering 4 eventlisteners (
fullscreenchange+ vendor prefixes), a single shared managerattaches exactly 4 listeners regardless of how many diagrams are on the page.
onMountedinline style hackthat forced
.controls { opacity: 1; visibility: visible }via JavaScript.Controls now default to
opacity: 1; visibility: visiblein CSS and areshown/hidden purely through CSS classes and transitions.
observeOffscreenElements()now reuses theexisting
lazyObserverinstead of disconnecting and recreating it on everycall, eliminating unnecessary observer churn during route transitions.
useMermaidDownloadnow strips<script>,<iframe>,<object>,<embed>, stylesheet<link>elements, and allon*event-handler attributes from the cloned SVG before serialisation, preventing
malicious content from being exported even when
securityLevel: 'loose'isused.
wheelandmousemovehandlers now coalesce rapid events viarequestAnimationFrame,limiting reactive style updates to the browser's frame rate instead of firing
on every event (60+ per second).
MermaidRenderer.setConfig()now deep-merges nestedobjects instead of shallow-spread, so
flowchart: { useMaxWidth: true }merges with defaults instead of replacing the entire
flowchartsection.--mermaid-control-bg,--mermaid-control-text,--mermaid-control-border,--mermaid-control-shadow,--mermaid-control-radius,--mermaid-control-padding,--mermaid-control-gap,--mermaid-spinner-duration,--mermaid-notification-duration,--mermaid-error-bg,--mermaid-error-border, and--mermaid-error-text.All hardcoded colour, spacing, and timing values in
style.cssnow use thesevariables with fallbacks to the VitePress
--vp-c-*tokens, allowing themecustomisation without overriding the entire stylesheet.
.mermaid-dialog-backdropnowuses
rgba(0,0,0,0.5)as a solid fallback;backdrop-filter: blur(4px)isapplied only in browsers that support it via
@supports, fixing the invisiblebackdrop in Firefox and older browsers.
MIN_SCALE(0.2),MAX_SCALE(10), andZOOM_STEP(1.2) are now configurable via theMermaidNavigationOptionsparameter of
useMermaidNavigation(), enabling accessibility anddiagram-specific customisation.
Added
securityLevelsetting, itsimpact on inline HTML, and when to use
'loose'vs'strict'.MermaidRenderer.resetInstance()+destroy()— staticresetInstance()method and private
destroy()for proper cleanup of observers, timers, DOMreferences, and event listeners (including
popstateandvitepress:routeChanged). Useful in test teardown and SPA route transitions.useMermaidDownloadcomposable — extracted the download logic (SVG / PNG/ JPEG export) from
MermaidDiagram.vueinto a dedicated composable forbetter testability and separation of concerns.
role="img"andaria-labelon the diagram wrapper so screen readersannounce the diagram purpose.
+/-for zoom,0for reset, arrow keys for pan,ffor fullscreen — all when the diagram wrapper has focus(
tabindex="0").role="status"+aria-live="polite"on a visually-hidden element thatannounces "Loading diagram…" and "Diagram loaded" states.
role="alert"on the error container (MermaidError.vue) so screen readersimmediately announce rendering failures.
.sr-onlyutility class instyle.cssfor visually-hidden butscreen-reader-accessible content.
_resetFullscreenManager()— internal test helper for resetting thesingleton fullscreen manager state between test runs.
resetRenderPipeline()— exported fromuseMermaidRendererso thatMermaidRenderer.handleRouteChange()can reset the global promise chain,preventing stale promise accumulation across SPA route changes.
prefers-reduced-motionsupport — animations and transitions are disabledvia
@media (prefers-reduced-motion: reduce)for users who have requestedreduced motion in their OS settings.
MermaidError.vuenow acceptserrorText,showDetailsText, andhideDetailsTextprops that flow from the toolbar i18nsystem (
resolvedToolbar.i18n.tooltips), enabling localised error messagesand toggle button text.
custom properties.
Fixed
popstateandvitepress:routeChangedlisteners added inMermaidRenderer.initialize()arenow properly removed in
destroy().timeout in
useMermaidRendereris now tracked and cleared inonUnmounted,preventing callbacks on unmounted components.
NodeJS.Timeouttype in browser code — replaced withReturnType<typeof setTimeout>so the correctnumbertype is used inbrowser bundles (previously masked by
skipLibCheck).Removed
createAppimport fromMermaidRenderer.ts.DownloadFormattype import fromMermaidDiagram.vue.Configuration
📅 Schedule: (UTC)
* * * * 0,1)🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate.
Test link