File: highlightjs.patch

package info (click to toggle)
macaulay2 1.21%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 133,096 kB
  • sloc: cpp: 110,377; ansic: 16,306; javascript: 4,193; makefile: 3,821; sh: 3,580; lisp: 764; yacc: 590; xml: 177; python: 140; perl: 114; lex: 65; awk: 3
file content (46 lines) | stat: -rw-r--r-- 1,221 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Description: Fixes for building highlight.js.
 - Backport to highlight.js 9, which is the version still in Debian.
Author: Doug Torrance <dtorrance@debian.org>
Forwarded: not-needed
Last-Update: 2022-05-16

--- a/M2/Macaulay2/editors/highlightjs/index.js
+++ b/M2/Macaulay2/editors/highlightjs/index.js
@@ -1,8 +1,11 @@
-import hljs from 'highlight.js/lib/core';
+import hljs from 'highlight.js/lib/highlight';
 import macaulay2 from './macaulay2.js';
 import 'highlight.js/styles/default.css';
 import './highlight-override.css';
 
 hljs.registerLanguage('macaulay2', macaulay2);
-hljs.configure({ cssSelector: 'code' });
-hljs.highlightAll();
+document.addEventListener('DOMContentLoaded', (event) => {
+  document.querySelectorAll('code').forEach((block) => {
+    hljs.highlightBlock(block);
+  });
+});
--- a/M2/Macaulay2/editors/highlightjs/macaulay2.js.in
+++ b/M2/Macaulay2/editors/highlightjs/macaulay2.js.in
@@ -28,16 +28,16 @@
     keywords: {
       keyword: [
 	@M2KEYWORDS@
-      ],
+      ].join(" "),
       type: [
 	@M2DATATYPES@
-      ],
+      ].join(" "),
       built_in: [
 	@M2FUNCTIONS@
-      ],
+      ].join(" "),
       literal: [
 	@M2CONSTANTS@
-      ]
+      ].join(" ")
     }
   }
 }