@rspress/shared 1.43.6 → 1.43.7
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/dist/node-utils.d.ts +6 -2
- package/dist/node-utils.js +4 -1
- package/dist/node-utils.mjs +4 -1
- package/package.json +1 -1
package/dist/node-utils.d.ts
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
import {
|
1
|
+
import type { MdxJsxAttribute } from 'mdast-util-mdx-jsx';
|
2
|
+
import type { MdxJsxAttributeValueExpression } from 'mdast-util-mdx-jsx';
|
3
|
+
import type { MdxJsxExpressionAttribute } from 'mdast-util-mdx-jsx';
|
2
4
|
import type { MdxJsxFlowElement } from 'mdast-util-mdx-jsx';
|
3
5
|
import type { MdxJsxTextElement } from 'mdast-util-mdx-jsx';
|
4
6
|
import type { PluggableList } from 'unified';
|
@@ -204,7 +206,9 @@ declare interface FrontMatterMeta {
|
|
204
206
|
[key: string]: unknown;
|
205
207
|
}
|
206
208
|
|
207
|
-
export declare
|
209
|
+
export declare function getNodeAttribute(node: MdxJsxFlowElement | MdxJsxTextElement, attrName: string, attribute?: false): string | MdxJsxAttributeValueExpression | null | undefined;
|
210
|
+
|
211
|
+
export declare function getNodeAttribute(node: MdxJsxFlowElement | MdxJsxTextElement, attrName: string, attribute: true): MdxJsxAttribute | MdxJsxExpressionAttribute | undefined;
|
208
212
|
|
209
213
|
declare interface Header {
|
210
214
|
id: string;
|
package/dist/node-utils.js
CHANGED
@@ -72,7 +72,10 @@ var __webpack_exports__ = {};
|
|
72
72
|
customId
|
73
73
|
];
|
74
74
|
};
|
75
|
-
|
75
|
+
function getNodeAttribute(node, attrName, attribute) {
|
76
|
+
const found = node.attributes.find((attr)=>'name' in attr && attr.name === attrName);
|
77
|
+
return attribute ? found : found?.value;
|
78
|
+
}
|
76
79
|
const external_node_path_namespaceObject = require("node:path");
|
77
80
|
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
78
81
|
const external_gray_matter_namespaceObject = require("gray-matter");
|
package/dist/node-utils.mjs
CHANGED
@@ -14,7 +14,10 @@ const extractTextAndId = (title)=>{
|
|
14
14
|
customId
|
15
15
|
];
|
16
16
|
};
|
17
|
-
|
17
|
+
function getNodeAttribute(node, attrName, attribute) {
|
18
|
+
const found = node.attributes.find((attr)=>'name' in attr && attr.name === attrName);
|
19
|
+
return attribute ? found : found?.value;
|
20
|
+
}
|
18
21
|
function loadFrontMatter(source, filepath, root, outputWarning = false) {
|
19
22
|
try {
|
20
23
|
const { content, data } = (0, __WEBPACK_EXTERNAL_MODULE_gray_matter_90c6cd0b__["default"])(source);
|