orz-markdown 1.2.1 → 1.2.2
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-include.d.ts","sourceRoot":"","sources":["../../src/plugins/markdown-include.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,UAAU,MAAM,aAAa,CAAC;AAG1C,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,UAAU,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"markdown-include.d.ts","sourceRoot":"","sources":["../../src/plugins/markdown-include.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,UAAU,MAAM,aAAa,CAAC;AAG1C,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,UAAU,GAAG,IAAI,CAqC5D"}
|
|
@@ -19,8 +19,11 @@ function registerMarkdownInclude(md) {
|
|
|
19
19
|
// Guard against nested includes
|
|
20
20
|
if (envObj['markdownIncludeActive'])
|
|
21
21
|
return '';
|
|
22
|
-
// Resolve path: prefer env.markdownBasePath (document dir) over
|
|
23
|
-
|
|
22
|
+
// Resolve path: prefer env.markdownBasePath (document dir) over the cwd.
|
|
23
|
+
// Guard `process` so this stays usable in a browser bundle (no Node
|
|
24
|
+
// globals); there the fs read below fails and the include renders empty.
|
|
25
|
+
const cwd = typeof process !== 'undefined' && process.cwd ? process.cwd() : '.';
|
|
26
|
+
const basePath = envObj['markdownBasePath'] ?? cwd;
|
|
24
27
|
const resolved = path_1.default.isAbsolute(filePath)
|
|
25
28
|
? filePath
|
|
26
29
|
: path_1.default.resolve(basePath, filePath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-include.js","sourceRoot":"","sources":["../../src/plugins/markdown-include.ts"],"names":[],"mappings":";;;;;AAKA,
|
|
1
|
+
{"version":3,"file":"markdown-include.js","sourceRoot":"","sources":["../../src/plugins/markdown-include.ts"],"names":[],"mappings":";;;;;AAKA,0D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;gBACT,MAAM,CAAC,uBAAuB,CAAC,GAAG,KAAK,CAAC;YAC1C,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
package/dist/runtime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,QA+ehC,CAAC;AAEF,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD"}
|
package/dist/runtime.js
CHANGED
|
@@ -82,8 +82,40 @@ exports.browserRuntimeScript = String.raw `
|
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
function initTabs(root) {
|
|
86
|
+
if (!root || typeof root.querySelectorAll !== 'function') return;
|
|
87
|
+
Array.prototype.slice.call(root.querySelectorAll('.tabs')).forEach(function (tabs) {
|
|
88
|
+
// data-js both guards re-init and switches the theme CSS from the no-JS
|
|
89
|
+
// fallback (all panels shown) to JS mode (only the .active panel shown).
|
|
90
|
+
if (tabs.getAttribute('data-js') === '1') return;
|
|
91
|
+
var panels = Array.prototype.slice.call(tabs.querySelectorAll(':scope > .tab'));
|
|
92
|
+
if (!panels.length) return;
|
|
93
|
+
tabs.setAttribute('data-js', '1');
|
|
94
|
+
|
|
95
|
+
var bar = global.document.createElement('div');
|
|
96
|
+
bar.className = 'tabs-bar';
|
|
97
|
+
panels.forEach(function (panel, i) {
|
|
98
|
+
var label = panel.getAttribute('data-label') || 'Tab ' + (i + 1);
|
|
99
|
+
var btn = global.document.createElement('button');
|
|
100
|
+
btn.className = 'tabs-bar-btn' + (i === 0 ? ' active' : '');
|
|
101
|
+
btn.textContent = label;
|
|
102
|
+
btn.addEventListener('click', function () {
|
|
103
|
+
Array.prototype.slice.call(tabs.querySelectorAll('.tabs-bar-btn')).forEach(function (b) { b.classList.remove('active'); });
|
|
104
|
+
panels.forEach(function (p) { p.classList.remove('active'); });
|
|
105
|
+
btn.classList.add('active');
|
|
106
|
+
panel.classList.add('active');
|
|
107
|
+
});
|
|
108
|
+
bar.appendChild(btn);
|
|
109
|
+
});
|
|
110
|
+
tabs.insertBefore(bar, tabs.firstChild);
|
|
111
|
+
panels[0].classList.add('active');
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
85
115
|
function init(root) {
|
|
86
|
-
|
|
116
|
+
var r = root || global.document;
|
|
117
|
+
initQrCodes(r);
|
|
118
|
+
initTabs(r);
|
|
87
119
|
}
|
|
88
120
|
|
|
89
121
|
// ---- copy-as-markdown: DOM -> Markdown walker ---------------------------
|
|
@@ -448,6 +480,7 @@ exports.browserRuntimeScript = String.raw `
|
|
|
448
480
|
global.OrzMarkdownRuntime = Object.assign({}, global.OrzMarkdownRuntime, {
|
|
449
481
|
init: init,
|
|
450
482
|
initQrCodes: initQrCodes,
|
|
483
|
+
initTabs: initTabs,
|
|
451
484
|
collapseQr: collapseQr,
|
|
452
485
|
elementToMarkdown: elementToMarkdown,
|
|
453
486
|
});
|
package/dist/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":";;;AAifA,0DAEC;AAnfY,QAAA,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+e7C,CAAC;AAEF,SAAgB,uBAAuB;IACrC,OAAO,4BAAoB,CAAC;AAC9B,CAAC"}
|