bedazzlr 0.2.2 → 0.2.4
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/lib/index.js +8 -5
- package/package.json +6 -6
package/lib/index.js
CHANGED
|
@@ -70,9 +70,11 @@ const countIndents = (root) => {
|
|
|
70
70
|
let indents = 0;
|
|
71
71
|
while (el) {
|
|
72
72
|
if (el.classList.contains('trivia')) {
|
|
73
|
-
|
|
73
|
+
if (el?.getAttribute('name') !== 'LeftOffset') {
|
|
74
|
+
return Infinity;
|
|
75
|
+
}
|
|
74
76
|
|
|
75
|
-
|
|
77
|
+
let leftOffset = el;
|
|
76
78
|
|
|
77
79
|
el = leftOffset.firstElementChild;
|
|
78
80
|
|
|
@@ -114,9 +116,9 @@ export const removeDocumentListeners = () => {
|
|
|
114
116
|
}
|
|
115
117
|
};
|
|
116
118
|
|
|
117
|
-
export const highlightCode = (el, language, matcher = language.defaultMatcher) => {
|
|
119
|
+
export const highlightCode = (el, language, matcher = language.defaultMatcher, options) => {
|
|
118
120
|
let tags = hoistTrivia(
|
|
119
|
-
streamParse(language, matcher, el.innerText, null, { holdShiftedNodes: true }),
|
|
121
|
+
streamParse(language, matcher, el.innerText, null, { ...options, holdShiftedNodes: true }),
|
|
120
122
|
)[Symbol.iterator]();
|
|
121
123
|
|
|
122
124
|
let open;
|
|
@@ -472,7 +474,7 @@ export const highlightCode = (el, language, matcher = language.defaultMatcher) =
|
|
|
472
474
|
});
|
|
473
475
|
};
|
|
474
476
|
|
|
475
|
-
export const highlightAll = (languages) => {
|
|
477
|
+
export const highlightAll = (languages, options) => {
|
|
476
478
|
let codeBlocks = document.querySelectorAll('code');
|
|
477
479
|
|
|
478
480
|
for (let block of codeBlocks) {
|
|
@@ -500,6 +502,7 @@ export const highlightAll = (languages) => {
|
|
|
500
502
|
),
|
|
501
503
|
)
|
|
502
504
|
: language.defaultMatcher,
|
|
505
|
+
options,
|
|
503
506
|
);
|
|
504
507
|
} catch (e) {
|
|
505
508
|
console.warn(e);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bedazzlr",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Code block syntax highlighting using BABLR",
|
|
5
5
|
"author": "Conrad Buck<conartist6@gmail.com>",
|
|
6
6
|
"type": "module",
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
"test": "mocha test/*.test.js"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@bablr/agast-helpers": "0.10.
|
|
19
|
-
"@bablr/agast-vm-helpers": "0.10.
|
|
20
|
-
"@bablr/boot": "0.11.
|
|
21
|
-
"@bablr/helpers": "0.25.
|
|
18
|
+
"@bablr/agast-helpers": "0.10.4",
|
|
19
|
+
"@bablr/agast-vm-helpers": "0.10.4",
|
|
20
|
+
"@bablr/boot": "0.11.3",
|
|
21
|
+
"@bablr/helpers": "0.25.2",
|
|
22
22
|
"@iter-tools/imm-stack": "1.2.0",
|
|
23
|
-
"bablr": "0.11.
|
|
23
|
+
"bablr": "0.11.3",
|
|
24
24
|
"classnames": "2.5.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|