-
Notifications
You must be signed in to change notification settings - Fork 1
/
syntaxhighlighter.min.js
41 lines (40 loc) · 1.76 KB
/
syntaxhighlighter.min.js
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
/**
* Copyright 2012-2023 Christoph M. Becker
*
* This file is part of Syntaxhighlighter_XH.
*
* Syntaxhighlighter_XH is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Syntaxhighlighter_XH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Syntaxhighlighter_XH. If not, see <http://www.gnu.org/licenses/>.
*/
(function () {
if (!("addEventListener" in document)) {
return;
}
document.addEventListener("DOMContentLoaded", function () {
Array.from(document.getElementsByClassName("brush:")).forEach(function (pre) {
// remove all HTML markup
pre.textContent = pre.textContent;
});
var aboutDialog = SyntaxHighlighter.config.strings.aboutDialog;
var brushes = JSON.parse(document.getElementsByName("syntaxhighlighter.brushes")[0].content);
SyntaxHighlighter.autoloader(...brushes);
var config = JSON.parse(document.getElementsByName("syntaxhighlighter.config")[0].content);
for (const prop in config) {
SyntaxHighlighter.defaults[prop] = config[prop];
}
var strings = JSON.parse(document.getElementsByName("syntaxhighlighter.strings")[0].content);
SyntaxHighlighter.config.strings = strings;
SyntaxHighlighter.config.strings.aboutDialog = aboutDialog;
SyntaxHighlighter.all();
});
}());