Comparing version 0.8.0 to 0.8.1
@@ -532,15 +532,15 @@ "use strict"; | ||
function parseChildren(children, lang, code) { | ||
var _a, _b, _c, _d; | ||
var _a, _b, _c; | ||
if (typeof children === "object" && (children == null ? void 0 : children.type) === "code") { | ||
return { | ||
code: (_b = (_a = children.props) == null ? void 0 : _a.children) == null ? void 0 : _b.trim(), | ||
lang: ((_d = (_c = children.props) == null ? void 0 : _c.className) == null ? void 0 : _d.replace("language-", "")) || "text" | ||
...getLanguageAndTitle((_c = children.props) == null ? void 0 : _c.className) | ||
}; | ||
} else if (typeof children === "object") { | ||
const subProps = import_react.default.Children.toArray(children).map((c) => { | ||
var _a2, _b2, _c2, _d2; | ||
var _a2, _b2, _c2; | ||
const codeProps = (_b2 = (_a2 = c.props) == null ? void 0 : _a2.children) == null ? void 0 : _b2.props; | ||
return { | ||
code: (_c2 = codeProps.children) == null ? void 0 : _c2.trim(), | ||
lang: ((_d2 = codeProps.className) == null ? void 0 : _d2.replace("language-", "")) || "text" | ||
...getLanguageAndTitle(codeProps.className) | ||
}; | ||
@@ -558,2 +558,20 @@ }); | ||
} | ||
function getLanguageAndTitle(className) { | ||
if (!className) { | ||
return { | ||
lang: "text" | ||
}; | ||
} | ||
const metastring = className.replace("language-", ""); | ||
const lang = metastring.split(".").pop(); | ||
if (lang !== metastring) { | ||
return { | ||
lang, | ||
title: metastring | ||
}; | ||
} | ||
return { | ||
lang | ||
}; | ||
} | ||
// Annotate the CommonJS export names for ESM import in node: | ||
@@ -560,0 +578,0 @@ 0 && (module.exports = { |
{ | ||
"name": "bright", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"main": "./dist/index.js", | ||
@@ -5,0 +5,0 @@ "module": "./dist/index.mjs", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36981
1192