You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ep...@apache.org on 2026/10/17 12:58:19 UTC
(solr) branch main updated: SOLR-18545: Update to released highlight.js library. Fix highlighting bugs in Solr Admin UI. (#5129)
This is an automated email from the ASF dual-hosted git repository.
epugh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new 830e547a6ad SOLR-18545: Update to released highlight.js library. Fix highlighting bugs in Solr Admin UI. (#5129)
830e547a6ad is described below
commit 830e547a6ad79e2096d893439e9f652181985e84
Author: Eric Pugh <ep...@opensourceconnections.com>
AuthorDate: Sat Oct 17 08:58:12 2026 -0400
SOLR-18545: Update to released highlight.js library. Fix highlighting bugs in Solr Admin UI. (#5129)
---
gradle/validation/rat-config.xml | 2 +-
solr/webapp/web/css/angular/common.css | 8 +++--
solr/webapp/web/index.html | 2 +-
solr/webapp/web/js/angular/app.js | 2 +-
solr/webapp/web/libs/highlight.js | 31 -----------------
solr/webapp/web/libs/highlight.js-11.12.0.min.js | 44 ++++++++++++++++++++++++
solr/webapp/web/partials/query.html | 3 --
solr/webapp/web/partials/stream.html | 2 +-
8 files changed, 54 insertions(+), 40 deletions(-)
diff --git a/gradle/validation/rat-config.xml b/gradle/validation/rat-config.xml
index 3028823c729..bb32dce1cc9 100644
--- a/gradle/validation/rat-config.xml
+++ b/gradle/validation/rat-config.xml
@@ -37,7 +37,7 @@
<!-- Various BSD-like third-party libraries with non-standard copyright headers -->
<license family="BSD-modi" id="BSD-modi" name="Modified BSD License">
<any>
- <text>THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS</text> <!-- highlight.js -->
+ <text>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS</text> <!-- highlight.js -->
</any>
</license>
diff --git a/solr/webapp/web/css/angular/common.css b/solr/webapp/web/css/angular/common.css
index df87254a803..0d06795694f 100644
--- a/solr/webapp/web/css/angular/common.css
+++ b/solr/webapp/web/css/angular/common.css
@@ -465,9 +465,11 @@ pre.syntax.language-json .number
color: blue;
}
-pre.syntax.language-json .literal
+pre.syntax.language-json .literal,
+pre.syntax.language-json .literal .keyword
{
color: firebrick;
+ font-weight: normal;
}
pre.syntax .string,
@@ -515,6 +517,7 @@ pre.syntax .django .tag .keyword
}
pre.syntax .attribute,
+pre.syntax .attr,
pre.syntax .variable,
pre.syntax .instancevar,
pre.syntax .lisp .body
@@ -522,7 +525,8 @@ pre.syntax .lisp .body
color: #008080;
}
-pre.syntax.language-json .attribute
+pre.syntax.language-json .attribute,
+pre.syntax.language-json .attr
{
color: black;
font-weight: bold;
diff --git a/solr/webapp/web/index.html b/solr/webapp/web/index.html
index 46535d6b742..6f63331ada2 100644
--- a/solr/webapp/web/index.html
+++ b/solr/webapp/web/index.html
@@ -65,7 +65,7 @@ limitations under the License.
<script src="libs/angular-route.min.js?_=${version}"></script>
<script src="libs/angular-cookies.min.js?_=${version}"></script>
<script src="libs/ngtimeago.js?_=${version}"></script>
- <script src="libs/highlight.js?_=${version}"></script>
+ <script src="libs/highlight.js-11.12.0.min.js?_=${version}"></script>
<script src="libs/d3.js?_=${version}"></script>
<script src="libs/ui-grid.min.js?_=${version}"></script>
<script src="libs/solr/index.js"></script>
diff --git a/solr/webapp/web/js/angular/app.js b/solr/webapp/web/js/angular/app.js
index aba91049975..20bd0078fc7 100644
--- a/solr/webapp/web/js/angular/app.js
+++ b/solr/webapp/web/js/angular/app.js
@@ -204,7 +204,7 @@ solrAdminApp.config([
})
.filter('highlight', function($sce) {
return function(input, lang) {
- if (lang && input && lang!="txt" && lang!="csv") return hljs.highlight(lang, input).value;
+ if (lang && input && hljs.getLanguage(lang)) return hljs.highlight(input, {language: lang}).value;
return input;
}
})
diff --git a/solr/webapp/web/libs/highlight.js b/solr/webapp/web/libs/highlight.js
deleted file mode 100644
index 527c3406719..00000000000
--- a/solr/webapp/web/libs/highlight.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-
-Copyright (c) 2006, Ivan Sagalaev
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of highlight.js nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-*/
-
-var hljs=new function(){function l(o){return o.replace(/&/gm,"&").replace(/</gm,"<").replace(/>/gm,">")}function b(p){for(var o=p.firstChild;o;o=o.nextSibling){if(o.nodeName=="CODE"){return o}if(!(o.nodeType==3&&o.nodeValue.match(/\s+/))){break}}}function h(p,o){return Array.prototype.map.call(p.childNodes,function(q){if(q.nodeType==3){return o?q.nodeValue.replace(/\n/g,""):q.nodeValue}if(q.nodeName=="BR"){return"\n"}return h(q,o)}).join("")}function a(q){var p=(q.className+" " [...]
diff --git a/solr/webapp/web/libs/highlight.js-11.12.0.min.js b/solr/webapp/web/libs/highlight.js-11.12.0.min.js
new file mode 100644
index 00000000000..5d86ac911d8
--- /dev/null
+++ b/solr/webapp/web/libs/highlight.js-11.12.0.min.js
@@ -0,0 +1,44 @@
+/*
+ * highlight.js 11.12.0 - https://github.com/highlightjs/highlight.js
+ *
+ * Custom minimal build: core + json, xml, javascript language modules only
+ * -- the languages the Solr Admin UI actually passes to the 'highlight'
+ * Angular filter. python/ruby/php were dropped after SOLR-17494 removed
+ * those response writers server-side, so the UI can no longer produce
+ * content in them. Built with:
+ * npm install highlight.js@11.12.0 esbuild
+ * npx esbuild entry.js --bundle --minify --format=iife
+ *
+ * BSD 3-Clause License
+ *
+ * Copyright (c) 2006, Ivan Sagalaev.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * * Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+(()=>{var fn=Object.create;var Ie=Object.defineProperty;var dn=Object.getOwnPropertyDescriptor;var hn=Object.getOwnPropertyNames;var En=Object.getPrototypeOf,pn=Object.prototype.hasOwnProperty;var bn=(e,n)=>()=>{try{return n||e((n={exports:{}}).exports,n),n.exports}catch(t){throw n=0,t}};var _n=(e,n,t,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let h of hn(n))!pn.call(e,h)&&h!==t&&Ie(e,h,{get:()=>n[h],enumerable:!(c=dn(n,h))||c.enumerable});return e};var Nn=(e,n,t)=>(t=e!=nul [...]
+https://github.com/highlightjs/highlight.js/issues/2277`),M=s,E=l),g===void 0&&(g=!0);let O={code:E,language:M};z("before:highlight",O);let y=O.result?O.result:C(O.language,O.code,g);return y.code=O.code,z("after:highlight",y),y}function C(s,l,g,E){let M=Object.create(null);function O(r,o){return r.keywords[o]}function y(){if(!f.keywords){A.addText(N);return}let r=0;f.keywordPatternRe.lastIndex=0;let o=f.keywordPatternRe.exec(N),d="";for(;o;){d+=N.substring(r,o.index);let p=v.case_insens [...]
+`),1;if(he>1e5&&he>o.index*3)throw new Error("potential infinite loop, way more iterations than matches");return N+=d,d.length}let v=T(s);if(!v)throw U(b.replace("{}",s)),new Error('Unknown language: "'+s+'"');let ln=rt(v),de="",f=E||ln,we={},A=new i.__emitter(i);on();let N="",te=0,P=0,he=0,Ee=!1;try{if(v.__emitTokens)v.__emitTokens(l,A);else{for(f.matcher.considerAll();;){he++,Ee?Ee=!1:f.matcher.considerAll(),f.matcher.lastIndex=P;let r=f.matcher.exec(l);if(!r)break;let o=l.substring(P, [...]
diff --git a/solr/webapp/web/partials/query.html b/solr/webapp/web/partials/query.html
index ccb9b990e9d..1209acc10df 100644
--- a/solr/webapp/web/partials/query.html
+++ b/solr/webapp/web/partials/query.html
@@ -93,9 +93,6 @@ limitations under the License.
<option ng-selected="selected" value=''>------</option>
<option>json</option>
<option>xml</option>
- <option>python</option>
- <option>ruby</option>
- <option>php</option>
<option>csv</option>
</select>
diff --git a/solr/webapp/web/partials/stream.html b/solr/webapp/web/partials/stream.html
index 683cf76d943..9376c859773 100644
--- a/solr/webapp/web/partials/stream.html
+++ b/solr/webapp/web/partials/stream.html
@@ -57,7 +57,7 @@ limitations under the License.
</div>
<div id="response">
- <pre class="syntax language-json"><code ng-bind-html="response.data | highlight:json | unsafe"></code></pre>
+ <pre class="syntax language-json"><code ng-bind-html="response.data | highlight:'json' | unsafe"></code></pre>
</div>
</div>