@farberg/reveal-template 1.1.8 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -68,14 +68,19 @@ function extractBeginEndSnippet(code, beginMarker, endMarker) {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
export default () => {
|
|
71
|
-
|
|
72
71
|
return {
|
|
73
72
|
id: 'show_code_snippets',
|
|
74
73
|
init: (deck) => {
|
|
75
74
|
|
|
76
|
-
deck.on('ready', () => {
|
|
75
|
+
deck.on('ready', async () => {
|
|
77
76
|
const highlightPlugin = deck.getPlugin("highlight")
|
|
78
77
|
|
|
78
|
+
highlightPlugin.hljs.configure({
|
|
79
|
+
// This suppresses the specific console warning you are seeing
|
|
80
|
+
ignoreUnescapedHTML: true
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
|
|
79
84
|
for (let el of deck.getRevealElement().querySelectorAll("a[data-code]")) {
|
|
80
85
|
//console.log(`Loading code snippets, looking at`, el)
|
|
81
86
|
let language = el.getAttribute("data-code");
|
|
@@ -88,26 +93,25 @@ export default () => {
|
|
|
88
93
|
//console.log(`language = ${language}, url = ${url}, beginMarker = ${beginMarker}, endMarker = ${endMarker}, showLink = ${showLink} `)
|
|
89
94
|
|
|
90
95
|
if (url) {
|
|
91
|
-
fetch(url, { "cache": "no-store" })
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
showError(el, err)
|
|
102
|
-
})
|
|
96
|
+
const response = await fetch(url, { "cache": "no-store" })
|
|
97
|
+
const text = await response.text()
|
|
98
|
+
let code = extractBeginEndSnippet(text, beginMarker, endMarker)
|
|
99
|
+
|
|
100
|
+
if (outdentCode)
|
|
101
|
+
code = outdent(code)
|
|
102
|
+
|
|
103
|
+
const newEl = showCode(el, language, code, showLink ? url : null, outdent)
|
|
104
|
+
highlightPlugin.hljs.highlightElement(newEl)
|
|
105
|
+
|
|
103
106
|
} else {
|
|
104
107
|
showError(el, "No URL provided in elements innerText")
|
|
105
108
|
}
|
|
106
109
|
}
|
|
107
110
|
|
|
108
|
-
|
|
111
|
+
|
|
109
112
|
})
|
|
110
113
|
|
|
114
|
+
|
|
111
115
|
}
|
|
112
116
|
}
|
|
113
117
|
}
|