dumi 2.0.11 → 2.0.12
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,5 +1,3 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
|
|
3
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
2
|
|
|
5
3
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -31,7 +29,7 @@ export var useNavData = function useNavData() {
|
|
|
31
29
|
|
|
32
30
|
var _useState = useState(function () {
|
|
33
31
|
// use user config first
|
|
34
|
-
if (themeConfig.nav) return
|
|
32
|
+
if (themeConfig.nav) return Array.isArray(themeConfig.nav) ? themeConfig.nav : themeConfig.nav[locale.id]; // fallback to generate nav data from sidebar data
|
|
35
33
|
|
|
36
34
|
var data = Object.entries(sidebar).map(function (_ref) {
|
|
37
35
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import type { Root } from 'hast';
|
|
1
|
+
import type { Element, Root } from 'hast';
|
|
2
2
|
import type { Transformer } from 'unified';
|
|
3
|
+
/**
|
|
4
|
+
* Checks if `node` is a reactComponent
|
|
5
|
+
*/
|
|
6
|
+
export declare function isReactComponent(node: Element): boolean;
|
|
3
7
|
export default function rehypeIsolation(): Transformer<Root>;
|
|
@@ -22,7 +22,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
22
22
|
// src/loaders/markdown/transformer/rehypeIsolation.ts
|
|
23
23
|
var rehypeIsolation_exports = {};
|
|
24
24
|
__export(rehypeIsolation_exports, {
|
|
25
|
-
default: () => rehypeIsolation
|
|
25
|
+
default: () => rehypeIsolation,
|
|
26
|
+
isReactComponent: () => isReactComponent
|
|
26
27
|
});
|
|
27
28
|
module.exports = __toCommonJS(rehypeIsolation_exports);
|
|
28
29
|
var visit;
|
|
@@ -63,4 +64,6 @@ function rehypeIsolation() {
|
|
|
63
64
|
};
|
|
64
65
|
}
|
|
65
66
|
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
-
0 && (module.exports = {
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
isReactComponent
|
|
69
|
+
});
|
|
@@ -26,6 +26,7 @@ __export(rehypeText_exports, {
|
|
|
26
26
|
default: () => rehypeText
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(rehypeText_exports);
|
|
29
|
+
var import_rehypeIsolation = require("./rehypeIsolation");
|
|
29
30
|
var import_rehypeSlug = require("./rehypeSlug");
|
|
30
31
|
var CONTENT_TEXTS_OBJ_NAME = "$$contentTexts";
|
|
31
32
|
var visit;
|
|
@@ -35,7 +36,7 @@ var visit;
|
|
|
35
36
|
function findParagraphAncestor(ancestors) {
|
|
36
37
|
for (let i = ancestors.length - 1; i >= 0; i--) {
|
|
37
38
|
const node = ancestors[i];
|
|
38
|
-
if (node.type === "element" && node.tagName
|
|
39
|
+
if (node.type === "element" && (["p", "ul", "ol"].includes(node.tagName) || (0, import_rehypeIsolation.isReactComponent)(node)) || node.type === "root") {
|
|
39
40
|
return node;
|
|
40
41
|
}
|
|
41
42
|
}
|