This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch fix/performance-assets in repository https://gitbox.apache.org/repos/asf/camel-website.git
commit 7c1c7919a4eb1cfd63f9800f6a8381de38a2847c Author: Claus Ibsen <[email protected]> AuthorDate: Sun Nov 29 13:35:22 2026 +0100 Fix #1879: trim highlight.js, defer DocSearch, size and lazy-load blog images - highlight.js: require the core build and register the 24 languages the docs and blog actually use (inventoried from [source,LANG] blocks in the Antora content sources and the Hugo fenced code blocks). The vendor bundle drops from 965 KB to 84 KB raw (305 KB to 28 KB gzipped). - DocSearch: load the vendor script with defer. site.js still registers its DOMContentLoaded listener first, and deferred scripts run before that event, so window.docsearch is defined when the search box is initialised. - Add a Markdown image render hook: page-bundle raster images get their intrinsic width/height (no layout shift), every image after the first gets loading="lazy", and all get decoding="async". Remote, site-absolute and SVG images keep the plain <img>. - Drop the svg4everybody IE11 polyfill and the Open Sans .woff fallbacks (every face already has a .woff2), and preload the Open Sans 400 body face. - Rebuild the committed antora-ui-camel/public bundle. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y4dDj46SB6GniXf8mX2U6 --- antora-ui-camel/package.json | 1 - .../{site-30351b85a4.css => site-8614ed109c.css} | 2 +- antora-ui-camel/public/_/data/rev-manifest.json | 5 ++--- .../_/font/open-sans-latin-ext-300-italic.woff | Bin 32152 -> 0 bytes .../public/_/font/open-sans-latin-ext-300.woff | Bin 31344 -> 0 bytes .../_/font/open-sans-latin-ext-400-italic.woff | Bin 32064 -> 0 bytes .../public/_/font/open-sans-latin-ext-400.woff | Bin 31320 -> 0 bytes .../_/font/open-sans-latin-ext-700-italic.woff | Bin 30996 -> 0 bytes .../public/_/font/open-sans-latin-ext-700.woff | Bin 30324 -> 0 bytes .../_/font/open-sans-latin-ext-800-italic.woff | Bin 31428 -> 0 bytes .../public/_/font/open-sans-latin-ext-800.woff | Bin 31064 -> 0 bytes antora-ui-camel/public/_/helpers/asset.js | 5 ++--- .../public/_/js/vendor/highlight-34ee5f32ef.js | 1 - .../public/_/js/vendor/highlight-85caca4a95.js | 1 + .../public/_/js/vendor/svg4everybody-8ce71b89ac.js | 3 --- .../public/_/partials/footer-scripts.hbs | 5 ++--- antora-ui-camel/public/_/partials/head-styles.hbs | 3 ++- antora-ui-camel/public/_/rev-manifest | 5 ++--- antora-ui-camel/src/css/typeface-open-sans.css | 24 +++++++-------------- antora-ui-camel/src/js/vendor/highlight.bundle.js | 23 +++++++++++++++++++- .../src/js/vendor/svg4everybody.bundle.js | 4 ---- antora-ui-camel/src/partials/footer-scripts.hbs | 3 +-- antora-ui-camel/src/partials/head-styles.hbs | 1 + layouts/_default/_markup/render-image.html | 22 +++++++++++++++++++ layouts/partials/footer.html | 3 +-- layouts/partials/header.html | 1 + yarn.lock | 8 ------- 27 files changed, 68 insertions(+), 52 deletions(-) diff --git a/antora-ui-camel/package.json b/antora-ui-camel/package.json index 3998269d..ead58cc7 100644 --- a/antora-ui-camel/package.json +++ b/antora-ui-camel/package.json @@ -69,7 +69,6 @@ "require-from-string": "~2.0", "stylelint": "^15.11.0", "stylelint-config-standard": "^34.0.0", - "svg4everybody": "^2.1.9", "toml": "^5.0.1", "undertaker": "^2.0.0", "vinyl-buffer": "~1.0", diff --git a/antora-ui-camel/public/_/css/site-30351b85a4.css b/antora-ui-camel/public/_/css/site-8614ed109c.css similarity index 73% rename from antora-ui-camel/public/_/css/site-30351b85a4.css rename to antora-ui-camel/public/_/css/site-8614ed109c.css index 21fa2d89..1378b68e 100644 --- a/antora-ui-camel/public/_/css/site-30351b85a4.css +++ b/antora-ui-camel/public/_/css/site-8614ed109c.css @@ -1,4 +1,4 @@ -@layer fonts, base, chrome, content, primitives, pages, print;@layer fonts{@font-face{font-family:Open Sans;font-style:normal;font-display:swap;font-weight:300;src:local("Open Sans Light"),local("OpenSans-Light"),url(../font/open-sans-latin-ext-300.woff2) format("woff2"),url(../font/open-sans-latin-ext-300.woff) format("woff")}@font-face{font-family:Open Sans;font-style:italic;font-display:swap;font-weight:300;src:local("Open Sans Light Italic"),local("OpenSans-LightItalic"),url(../font/ [...] +@layer fonts, base, chrome, content, primitives, pages, print;@layer fonts{@font-face{font-family:Open Sans;font-style:normal;font-display:swap;font-weight:300;src:local("Open Sans Light"),local("OpenSans-Light"),url(../font/open-sans-latin-ext-300.woff2) format("woff2")}@font-face{font-family:Open Sans;font-style:italic;font-display:swap;font-weight:300;src:local("Open Sans Light Italic"),local("OpenSans-LightItalic"),url(../font/open-sans-latin-ext-300-italic.woff2) format("woff2")}@fo [...] /*! highlight.js theme for the 2026 redesign, per SCOPE.md section 2a. Replaces the GitHub light theme; --pre-background is now --color-ink. Colors live in vars.css as --syntax-*, shared with chroma.css. */.hljs-comment,.hljs-quote{color:#8f867a;font-style:italic}.hljs-keyword,.hljs-selector-tag,.hljs-subst{color:#e97826;font-weight:600}.hljs-attr,.hljs-literal,.hljs-number,.hljs-tag .hljs-attr,.hljs-template-variable,.hljs-variable{color:#e8c87a}.hljs-doctag,.hljs-string{color:#f2a05a}.hljs-section,.hljs-selector-id,.hljs-title{color:#faf7f1;font-weight:600}.hljs-subst{font-weight:400}.hljs-class .hljs-title,.hljs-type{c [...] diff --git a/antora-ui-camel/public/_/data/rev-manifest.json b/antora-ui-camel/public/_/data/rev-manifest.json index a39150fe..a170ef05 100644 --- a/antora-ui-camel/public/_/data/rev-manifest.json +++ b/antora-ui-camel/public/_/data/rev-manifest.json @@ -1,5 +1,5 @@ { - "css/site.css": "css/site-30351b85a4.css", + "css/site.css": "css/site-8614ed109c.css", "css/vendor/docsearch.css": "css/vendor/docsearch-5db8a73adb.css", "img/algolia.svg": "img/algolia-f4ab98e0de.svg", "img/apache-kafka.svg": "img/apache-kafka-88809b7472.svg", @@ -36,7 +36,6 @@ "img/user-stories.svg": "img/user-stories-cccc5f7c8f.svg", "js/site.js": "js/site-1fe1b00373.js", "js/vendor/docsearch.js": "js/vendor/docsearch-5c0cf4ef3a.js", - "js/vendor/highlight.js": "js/vendor/highlight-34ee5f32ef.js", - "js/vendor/svg4everybody.js": "js/vendor/svg4everybody-8ce71b89ac.js", + "js/vendor/highlight.js": "js/vendor/highlight-85caca4a95.js", "js/vendor/tabs.js": "js/vendor/tabs-3496628f2d.js" } \ No newline at end of file diff --git a/antora-ui-camel/public/_/font/open-sans-latin-ext-300-italic.woff b/antora-ui-camel/public/_/font/open-sans-latin-ext-300-italic.woff deleted file mode 100644 index 9709834b..00000000 Binary files a/antora-ui-camel/public/_/font/open-sans-latin-ext-300-italic.woff and /dev/null differ diff --git a/antora-ui-camel/public/_/font/open-sans-latin-ext-300.woff b/antora-ui-camel/public/_/font/open-sans-latin-ext-300.woff deleted file mode 100644 index bc319ea8..00000000 Binary files a/antora-ui-camel/public/_/font/open-sans-latin-ext-300.woff and /dev/null differ diff --git a/antora-ui-camel/public/_/font/open-sans-latin-ext-400-italic.woff b/antora-ui-camel/public/_/font/open-sans-latin-ext-400-italic.woff deleted file mode 100644 index 4f5d1cdf..00000000 Binary files a/antora-ui-camel/public/_/font/open-sans-latin-ext-400-italic.woff and /dev/null differ diff --git a/antora-ui-camel/public/_/font/open-sans-latin-ext-400.woff b/antora-ui-camel/public/_/font/open-sans-latin-ext-400.woff deleted file mode 100644 index 1552d1fa..00000000 Binary files a/antora-ui-camel/public/_/font/open-sans-latin-ext-400.woff and /dev/null differ diff --git a/antora-ui-camel/public/_/font/open-sans-latin-ext-700-italic.woff b/antora-ui-camel/public/_/font/open-sans-latin-ext-700-italic.woff deleted file mode 100644 index 3166f34b..00000000 Binary files a/antora-ui-camel/public/_/font/open-sans-latin-ext-700-italic.woff and /dev/null differ diff --git a/antora-ui-camel/public/_/font/open-sans-latin-ext-700.woff b/antora-ui-camel/public/_/font/open-sans-latin-ext-700.woff deleted file mode 100644 index 6901fc03..00000000 Binary files a/antora-ui-camel/public/_/font/open-sans-latin-ext-700.woff and /dev/null differ diff --git a/antora-ui-camel/public/_/font/open-sans-latin-ext-800-italic.woff b/antora-ui-camel/public/_/font/open-sans-latin-ext-800-italic.woff deleted file mode 100644 index 22a0c8f6..00000000 Binary files a/antora-ui-camel/public/_/font/open-sans-latin-ext-800-italic.woff and /dev/null differ diff --git a/antora-ui-camel/public/_/font/open-sans-latin-ext-800.woff b/antora-ui-camel/public/_/font/open-sans-latin-ext-800.woff deleted file mode 100644 index 9465bf20..00000000 Binary files a/antora-ui-camel/public/_/font/open-sans-latin-ext-800.woff and /dev/null differ diff --git a/antora-ui-camel/public/_/helpers/asset.js b/antora-ui-camel/public/_/helpers/asset.js index 2dca7242..5718b6a6 100644 --- a/antora-ui-camel/public/_/helpers/asset.js +++ b/antora-ui-camel/public/_/helpers/asset.js @@ -1,7 +1,7 @@ 'use strict' const manifest = { - "css/site.css": "css/site-30351b85a4.css", + "css/site.css": "css/site-8614ed109c.css", "css/vendor/docsearch.css": "css/vendor/docsearch-5db8a73adb.css", "img/algolia.svg": "img/algolia-f4ab98e0de.svg", "img/apache-kafka.svg": "img/apache-kafka-88809b7472.svg", @@ -38,8 +38,7 @@ const manifest = { "img/user-stories.svg": "img/user-stories-cccc5f7c8f.svg", "js/site.js": "js/site-1fe1b00373.js", "js/vendor/docsearch.js": "js/vendor/docsearch-5c0cf4ef3a.js", - "js/vendor/highlight.js": "js/vendor/highlight-34ee5f32ef.js", - "js/vendor/svg4everybody.js": "js/vendor/svg4everybody-8ce71b89ac.js", + "js/vendor/highlight.js": "js/vendor/highlight-85caca4a95.js", "js/vendor/tabs.js": "js/vendor/tabs-3496628f2d.js" } diff --git a/antora-ui-camel/public/_/js/vendor/highlight-34ee5f32ef.js b/antora-ui-camel/public/_/js/vendor/highlight-34ee5f32ef.js deleted file mode 100644 index 27016df1..00000000 --- a/antora-ui-camel/public/_/js/vendor/highlight-34ee5f32ef.js +++ /dev/null @@ -1 +0,0 @@ -!function(){function e(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(a=>{const n=t[a],r=typeof n;"object"!==r&&"function"!==r||Object.isFrozen(n)||e(n)}),t}class t{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function [...] \ No newline at end of file diff --git a/antora-ui-camel/public/_/js/vendor/highlight-85caca4a95.js b/antora-ui-camel/public/_/js/vendor/highlight-85caca4a95.js new file mode 100644 index 00000000..c3a90342 --- /dev/null +++ b/antora-ui-camel/public/_/js/vendor/highlight-85caca4a95.js @@ -0,0 +1 @@ +!function(){function e(n){return n instanceof Map?n.clear=n.delete=n.set=function(){throw new Error("map is read-only")}:n instanceof Set&&(n.add=n.clear=n.delete=function(){throw new Error("set is read-only")}),Object.freeze(n),Object.getOwnPropertyNames(n).forEach(t=>{const a=n[t],i=typeof a;"object"!==i&&"function"!==i||Object.isFrozen(a)||e(a)}),n}class n{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function [...] \ No newline at end of file diff --git a/antora-ui-camel/public/_/js/vendor/svg4everybody-8ce71b89ac.js b/antora-ui-camel/public/_/js/vendor/svg4everybody-8ce71b89ac.js deleted file mode 100644 index 790bc905..00000000 --- a/antora-ui-camel/public/_/js/vendor/svg4everybody-8ce71b89ac.js +++ /dev/null @@ -1,3 +0,0 @@ -!function(){var e,t,n={exports:{}};e=this,t=function(){ -/*! svg4everybody v2.1.9 | github.com/jonathantneal/svg4everybody */ -function e(e,t,n){if(n){var i=document.createDocumentFragment(),r=!t.hasAttribute("viewBox")&&n.getAttribute("viewBox");r&&t.setAttribute("viewBox",r);for(var a=n.cloneNode(!0);a.childNodes.length;)i.appendChild(a.firstChild);e.appendChild(i)}}function t(t){t.onreadystatechange=function(){if(4===t.readyState){var n=t._cachedDocument;n||((n=t._cachedDocument=document.implementation.createHTMLDocument("")).body.innerHTML=t.responseText,t._cachedTarget={}),t._embeds.splice(0).map(function(i [...] \ No newline at end of file diff --git a/antora-ui-camel/public/_/partials/footer-scripts.hbs b/antora-ui-camel/public/_/partials/footer-scripts.hbs index c371a608..e4372c1b 100644 --- a/antora-ui-camel/public/_/partials/footer-scripts.hbs +++ b/antora-ui-camel/public/_/partials/footer-scripts.hbs @@ -1,7 +1,6 @@ -<script src="{{uiRootPath}}/js/vendor/docsearch-5c0cf4ef3a.js"></script> +<script defer src="{{uiRootPath}}/js/vendor/docsearch-5c0cf4ef3a.js"></script> <script src="{{uiRootPath}}/js/site-1fe1b00373.js"></script> -<script async src="{{uiRootPath}}/js/vendor/highlight-34ee5f32ef.js"></script> -<script async src="{{uiRootPath}}/js/vendor/svg4everybody-8ce71b89ac.js"></script> +<script async src="{{uiRootPath}}/js/vendor/highlight-85caca4a95.js"></script> <script async src="{{{uiRootPath}}}/js/vendor/tabs-3496628f2d.js" data-sync-storage-key="preferred-tab"></script> {{#if page.attributes.asciinemacasts}} {{> asciinema-load-scripts}} diff --git a/antora-ui-camel/public/_/partials/head-styles.hbs b/antora-ui-camel/public/_/partials/head-styles.hbs index 59ae8315..911e7099 100644 --- a/antora-ui-camel/public/_/partials/head-styles.hbs +++ b/antora-ui-camel/public/_/partials/head-styles.hbs @@ -1,5 +1,6 @@ + <link rel="preload" href="{{uiRootPath}}/font/open-sans-latin-ext-400.woff2" as="font" type="font/woff2" crossorigin> <link rel="stylesheet" href="{{uiRootPath}}/css/vendor/docsearch-5db8a73adb.css"> - <link rel="stylesheet" href="{{uiRootPath}}/css/site-30351b85a4.css"> + <link rel="stylesheet" href="{{uiRootPath}}/css/site-8614ed109c.css"> {{!-- NOTE the asciinema partials are injected into the UI catalog by @springio/antora-extensions at Antora build time, so they only exist during a site build. Guarding on the page attribute the extension sets keeps the assets off pages with no cast, diff --git a/antora-ui-camel/public/_/rev-manifest b/antora-ui-camel/public/_/rev-manifest index a39150fe..a170ef05 100644 --- a/antora-ui-camel/public/_/rev-manifest +++ b/antora-ui-camel/public/_/rev-manifest @@ -1,5 +1,5 @@ { - "css/site.css": "css/site-30351b85a4.css", + "css/site.css": "css/site-8614ed109c.css", "css/vendor/docsearch.css": "css/vendor/docsearch-5db8a73adb.css", "img/algolia.svg": "img/algolia-f4ab98e0de.svg", "img/apache-kafka.svg": "img/apache-kafka-88809b7472.svg", @@ -36,7 +36,6 @@ "img/user-stories.svg": "img/user-stories-cccc5f7c8f.svg", "js/site.js": "js/site-1fe1b00373.js", "js/vendor/docsearch.js": "js/vendor/docsearch-5c0cf4ef3a.js", - "js/vendor/highlight.js": "js/vendor/highlight-34ee5f32ef.js", - "js/vendor/svg4everybody.js": "js/vendor/svg4everybody-8ce71b89ac.js", + "js/vendor/highlight.js": "js/vendor/highlight-85caca4a95.js", "js/vendor/tabs.js": "js/vendor/tabs-3496628f2d.js" } \ No newline at end of file diff --git a/antora-ui-camel/src/css/typeface-open-sans.css b/antora-ui-camel/src/css/typeface-open-sans.css index 2424321f..f451b6d7 100644 --- a/antora-ui-camel/src/css/typeface-open-sans.css +++ b/antora-ui-camel/src/css/typeface-open-sans.css @@ -7,8 +7,7 @@ src: local('Open Sans Light'), local('OpenSans-Light'), - url('~@openfonts/open-sans_latin-ext/files/open-sans-latin-ext-300.woff2') format('woff2'), - url('~@openfonts/open-sans_latin-ext/files/open-sans-latin-ext-300.woff') format('woff'); + url('~@openfonts/open-sans_latin-ext/files/open-sans-latin-ext-300.woff2') format('woff2'); } /* open-sans-300italic - latin-ext */ @font-face { @@ -19,8 +18,7 @@ src: local('Open Sans Light Italic'), local('OpenSans-LightItalic'), - url('~@openfonts/open-sans_latin-ext/files/open-sans-latin-ext-300-italic.woff2') format('woff2'), - url('~@openfonts/open-sans_latin-ext/files/open-sans-latin-ext-300-italic.woff') format('woff'); + url('~@openfonts/open-sans_latin-ext/files/open-sans-latin-ext-300-italic.woff2') format('woff2'); } /* open-sans-400normal - latin-ext */ @font-face { @@ -31,8 +29,7 @@ src: local('Open Sans Regular'), local('OpenSans-Regular'), - url('~@openfonts/open-sans_latin-ext/files/open-sans-latin-ext-400.woff2') format('woff2'), - url('~@openfonts/open-sans_latin-ext/files/open-sans-latin-ext-400.woff') format('woff'); + url('~@openfonts/open-sans_latin-ext/files/open-sans-latin-ext-400.woff2') format('woff2'); } /* open-sans-400italic - latin-ext */ @font-face { @@ -43,8 +40,7 @@ src: local('Open Sans Italic'), local('OpenSans-Italic'), - url('~@openfonts/open-sans_latin-ext/files/open-sans-latin-ext-400-italic.woff2') format('woff2'), - url('~@openfonts/open-sans_latin-ext/files/open-sans-latin-ext-400-italic.woff') format('woff'); + url('~@openfonts/open-sans_latin-ext/files/open-sans-latin-ext-400-italic.woff2') format('woff2'); } /* open-sans-700normal - latin-ext */ @font-face { @@ -55,8 +51,7 @@ src: local('Open Sans Bold'), local('OpenSans-Bold'), - url('~@openfonts/open-sans_latin-ext/files/open-sans-latin-ext-700.woff2') format('woff2'), - url('~@openfonts/open-sans_latin-ext/files/open-sans-latin-ext-700.woff') format('woff'); + url('~@openfonts/open-sans_latin-ext/files/open-sans-latin-ext-700.woff2') format('woff2'); } /* open-sans-700italic - latin-ext */ @font-face { @@ -67,8 +62,7 @@ src: local('Open Sans Bold Italic'), local('OpenSans-BoldItalic'), - url('~@openfonts/open-sans_latin-ext/files/open-sans-latin-ext-700-italic.woff2') format('woff2'), - url('~@openfonts/open-sans_latin-ext/files/open-sans-latin-ext-700-italic.woff') format('woff'); + url('~@openfonts/open-sans_latin-ext/files/open-sans-latin-ext-700-italic.woff2') format('woff2'); } /* open-sans-800normal - latin-ext */ @font-face { @@ -79,8 +73,7 @@ src: local('Open Sans ExtraBold'), local('OpenSans-ExtraBold'), - url('~@openfonts/open-sans_latin-ext/files/open-sans-latin-ext-800.woff2') format('woff2'), - url('~@openfonts/open-sans_latin-ext/files/open-sans-latin-ext-800.woff') format('woff'); + url('~@openfonts/open-sans_latin-ext/files/open-sans-latin-ext-800.woff2') format('woff2'); } /* open-sans-800italic - latin-ext */ @font-face { @@ -91,6 +84,5 @@ src: local('Open Sans ExtraBold Italic'), local('OpenSans-ExtraBoldItalic'), - url('~@openfonts/open-sans_latin-ext/files/open-sans-latin-ext-800-italic.woff2') format('woff2'), - url('~@openfonts/open-sans_latin-ext/files/open-sans-latin-ext-800-italic.woff') format('woff'); + url('~@openfonts/open-sans_latin-ext/files/open-sans-latin-ext-800-italic.woff2') format('woff2'); } diff --git a/antora-ui-camel/src/js/vendor/highlight.bundle.js b/antora-ui-camel/src/js/vendor/highlight.bundle.js index 4b537980..e891cecd 100644 --- a/antora-ui-camel/src/js/vendor/highlight.bundle.js +++ b/antora-ui-camel/src/js/vendor/highlight.bundle.js @@ -1,10 +1,31 @@ ;(function () { - var hljs = require('highlight.js') + // NOTE require the core build and register only the languages the docs and the blog use. + // require('highlight.js') pulls in all ~190 languages (~300 KB gzipped) on every page. + // The list comes from the [source,LANG] blocks in the Antora content sources and the + // fenced code blocks in the Hugo content; a block in any other language is left as plain + // text (hljs safe mode), and aliases such as sh, console, html, yml and js are covered by + // the language that declares them. + var hljs = require('highlight.js/lib/core') + hljs.registerLanguage('bash', require('highlight.js/lib/languages/bash')) + hljs.registerLanguage('css', require('highlight.js/lib/languages/css')) hljs.registerLanguage('dockerfile', require('highlight.js/lib/languages/dockerfile')) + hljs.registerLanguage('dos', require('highlight.js/lib/languages/dos')) + hljs.registerLanguage('go', require('highlight.js/lib/languages/go')) + hljs.registerLanguage('gradle', require('highlight.js/lib/languages/gradle')) + hljs.registerLanguage('graphql', require('highlight.js/lib/languages/graphql')) hljs.registerLanguage('groovy', require('highlight.js/lib/languages/groovy')) hljs.registerLanguage('java', require('highlight.js/lib/languages/java')) + hljs.registerLanguage('javascript', require('highlight.js/lib/languages/javascript')) hljs.registerLanguage('json', require('highlight.js/lib/languages/json')) + hljs.registerLanguage('kotlin', require('highlight.js/lib/languages/kotlin')) + hljs.registerLanguage('makefile', require('highlight.js/lib/languages/makefile')) + hljs.registerLanguage('markdown', require('highlight.js/lib/languages/markdown')) + hljs.registerLanguage('plaintext', require('highlight.js/lib/languages/plaintext')) + hljs.registerLanguage('powershell', require('highlight.js/lib/languages/powershell')) hljs.registerLanguage('properties', require('highlight.js/lib/languages/properties')) + hljs.registerLanguage('protobuf', require('highlight.js/lib/languages/protobuf')) + hljs.registerLanguage('python', require('highlight.js/lib/languages/python')) + hljs.registerLanguage('rust', require('highlight.js/lib/languages/rust')) hljs.registerLanguage('shell', require('highlight.js/lib/languages/shell')) hljs.registerLanguage('sql', require('highlight.js/lib/languages/sql')) hljs.registerLanguage('xml', require('highlight.js/lib/languages/xml')) diff --git a/antora-ui-camel/src/js/vendor/svg4everybody.bundle.js b/antora-ui-camel/src/js/vendor/svg4everybody.bundle.js deleted file mode 100644 index 550b2c3d..00000000 --- a/antora-ui-camel/src/js/vendor/svg4everybody.bundle.js +++ /dev/null @@ -1,4 +0,0 @@ -;(function () { - var svg4everybody = require('svg4everybody') - svg4everybody() -})() diff --git a/antora-ui-camel/src/partials/footer-scripts.hbs b/antora-ui-camel/src/partials/footer-scripts.hbs index bca81c55..8aab0b3b 100644 --- a/antora-ui-camel/src/partials/footer-scripts.hbs +++ b/antora-ui-camel/src/partials/footer-scripts.hbs @@ -1,7 +1,6 @@ -<script src="{{uiRootPath}}/js/vendor/docsearch.js"></script> +<script defer src="{{uiRootPath}}/js/vendor/docsearch.js"></script> <script src="{{uiRootPath}}/js/site.js"></script> <script async src="{{uiRootPath}}/js/vendor/highlight.js"></script> -<script async src="{{uiRootPath}}/js/vendor/svg4everybody.js"></script> <script async src="{{{uiRootPath}}}/js/vendor/tabs.js" data-sync-storage-key="preferred-tab"></script> {{#if page.attributes.asciinemacasts}} {{> asciinema-load-scripts}} diff --git a/antora-ui-camel/src/partials/head-styles.hbs b/antora-ui-camel/src/partials/head-styles.hbs index 0dbb7cea..17c49cae 100644 --- a/antora-ui-camel/src/partials/head-styles.hbs +++ b/antora-ui-camel/src/partials/head-styles.hbs @@ -1,3 +1,4 @@ + <link rel="preload" href="{{uiRootPath}}/font/open-sans-latin-ext-400.woff2" as="font" type="font/woff2" crossorigin> <link rel="stylesheet" href="{{uiRootPath}}/css/vendor/docsearch.css"> <link rel="stylesheet" href="{{uiRootPath}}/css/site.css"> {{!-- NOTE the asciinema partials are injected into the UI catalog by diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html new file mode 100644 index 00000000..92ae97df --- /dev/null +++ b/layouts/_default/_markup/render-image.html @@ -0,0 +1,22 @@ +{{- /* Markdown images. A raster image from the page bundle gets its intrinsic width and + height, so the browser reserves the space before the file arrives (no layout shift), + and every image after the first is lazy-loaded and decoded off the main thread. The + first image on a page is usually the lead image, near the top, so it loads eagerly. + Remote, site-absolute (/...) and SVG images keep the plain <img> Goldmark would emit. + The CSS already scales images with max-width: 100% and height: auto, so the width and + height attributes only set the aspect ratio. + NOTE .PlainText mixes typographer entities (’) with raw characters (&), so it is + unescaped first and then escaped once by the template, never twice. */ -}} +{{- $width := 0 -}} +{{- $height := 0 -}} +{{- $u := urls.Parse .Destination -}} +{{- if and (not $u.IsAbs) (not (strings.HasPrefix $u.Path "/")) -}} + {{- with .Page.Resources.Get (strings.TrimPrefix "./" $u.Path) -}} + {{- if and (eq .ResourceType "image") (in (slice "png" "jpeg" "gif" "webp") .MediaType.SubType) -}} + {{- $width = .Width -}} + {{- $height = .Height -}} + {{- end -}} + {{- end -}} +{{- end -}} +<img src="{{ .Destination | safeURL }}" alt="{{ .PlainText | htmlUnescape }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if $width }} width="{{ $width }}" height="{{ $height }}"{{ end }}{{ if gt .Ordinal 0 }} loading="lazy"{{ end }} decoding="async"> +{{- /**/ -}} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index c46c0886..55470330 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -56,10 +56,9 @@ </div> </div> </footer> - <script src="{{ path.Join "_" (index .Site.Data "rev-manifest" "js/vendor/docsearch.js") | relURL }}"></script> + <script defer src="{{ path.Join "_" (index .Site.Data "rev-manifest" "js/vendor/docsearch.js") | relURL }}"></script> <script src="{{ path.Join "_" (index .Site.Data "rev-manifest" "js/site.js") | relURL }}"></script> <script async src="{{ path.Join "_" (index .Site.Data "rev-manifest" "js/vendor/highlight.js") | relURL }}"></script> - <script async src="{{ path.Join "_" (index .Site.Data "rev-manifest" "js/vendor/svg4everybody.js") | relURL }}"></script> {{ partial "seo/main" . }} </body> diff --git a/layouts/partials/header.html b/layouts/partials/header.html index b0ca1d67..eca9839f 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -50,6 +50,7 @@ {{ if .Keywords}} <meta name="keywords" content="{{ delimit .Keywords "," }}"> {{ end }} + <link rel="preload" href="{{ "_/font/open-sans-latin-ext-400.woff2" | relURL }}" as="font" type="font/woff2" crossorigin> <link rel="stylesheet" href="{{ path.Join "_" (index .Site.Data "rev-manifest" "css/vendor/docsearch.css") | relURL }}"> <link rel="stylesheet" href="{{ path.Join "_" (index .Site.Data "rev-manifest" "css/site.css") | relURL }}"> </head> diff --git a/yarn.lock b/yarn.lock index b0aec64d..6c848bd9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3983,7 +3983,6 @@ __metadata: require-from-string: "npm:~2.0" stylelint: "npm:^15.11.0" stylelint-config-standard: "npm:^34.0.0" - svg4everybody: "npm:^2.1.9" toml: "npm:^5.0.1" undertaker: "npm:^2.0.0" vinyl-buffer: "npm:~1.0" @@ -19177,13 +19176,6 @@ __metadata: languageName: node linkType: hard -"svg4everybody@npm:^2.1.9": - version: 2.1.9 - resolution: "svg4everybody@npm:2.1.9" - checksum: 10/084ea233e2daea979777a879a90e72205e96becbac1c2a26e649d35eb237d08fb9cd5166ff84d6987d573af07e120347f6eceec69126a39ba3a407bc531fcfae - languageName: node - linkType: hard - "svgo@npm:^2.5.0": version: 2.8.4 resolution: "svgo@npm:2.8.4"
