mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-09 12:58:01 +02:00
feat(mdx-loader): upgrade to MDX v3 + (#9451)
This commit is contained in:
parent
8d19054d91
commit
7e456ece3c
49 changed files with 37351 additions and 30469 deletions
65
jest/vendor/mdast-util-to-string@4.0.0.js
vendored
Normal file
65
jest/vendor/mdast-util-to-string@4.0.0.js
vendored
Normal file
|
@ -0,0 +1,65 @@
|
|||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all2) => {
|
||||
for (var name in all2)
|
||||
__defProp(target, name, { get: all2[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// node_modules/mdast-util-to-string/index.js
|
||||
var mdast_util_to_string_exports = {};
|
||||
__export(mdast_util_to_string_exports, {
|
||||
toString: () => toString
|
||||
});
|
||||
module.exports = __toCommonJS(mdast_util_to_string_exports);
|
||||
|
||||
// node_modules/mdast-util-to-string/lib/index.js
|
||||
var emptyOptions = {};
|
||||
function toString(value, options) {
|
||||
const settings = options || emptyOptions;
|
||||
const includeImageAlt = typeof settings.includeImageAlt === "boolean" ? settings.includeImageAlt : true;
|
||||
const includeHtml = typeof settings.includeHtml === "boolean" ? settings.includeHtml : true;
|
||||
return one(value, includeImageAlt, includeHtml);
|
||||
}
|
||||
function one(value, includeImageAlt, includeHtml) {
|
||||
if (node(value)) {
|
||||
if ("value" in value) {
|
||||
return value.type === "html" && !includeHtml ? "" : value.value;
|
||||
}
|
||||
if (includeImageAlt && "alt" in value && value.alt) {
|
||||
return value.alt;
|
||||
}
|
||||
if ("children" in value) {
|
||||
return all(value.children, includeImageAlt, includeHtml);
|
||||
}
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
return all(value, includeImageAlt, includeHtml);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
function all(values, includeImageAlt, includeHtml) {
|
||||
const result = [];
|
||||
let index = -1;
|
||||
while (++index < values.length) {
|
||||
result[index] = one(values[index], includeImageAlt, includeHtml);
|
||||
}
|
||||
return result.join("");
|
||||
}
|
||||
function node(value) {
|
||||
return Boolean(value && typeof value === "object");
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
toString
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue