@thallylabs/migrate 0.2.37 → 0.2.38
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/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/url-migration.js +8 -1
- package/dist/url-migration.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9095,7 +9095,14 @@ ${normalized.slice(1).map((row) => `| ${row.join(" | ")} |`).join("\n")}
|
|
|
9095
9095
|
const fragment = load2(element.outerHTML);
|
|
9096
9096
|
const tokenLines = fragment(".token-line").toArray();
|
|
9097
9097
|
const code = (tokenLines.length > 0 ? tokenLines.map((line) => fragment(line).text()).join("\n") : fragment("pre").text()).replace(/\n$/, "");
|
|
9098
|
-
const language =
|
|
9098
|
+
const language = ["code", "pre"].flatMap((selector) => {
|
|
9099
|
+
const block = fragment(selector).first();
|
|
9100
|
+
return [
|
|
9101
|
+
block.attr("language"),
|
|
9102
|
+
block.attr("data-language"),
|
|
9103
|
+
block.attr("class")?.match(/(?:^|\s)(?:language-|lang-)([A-Za-z0-9_+-]+)(?=\s|$)/)?.[1]
|
|
9104
|
+
];
|
|
9105
|
+
}).find((value) => value !== void 0 && /^[A-Za-z0-9_+-]{1,64}$/.test(value)) ?? "";
|
|
9099
9106
|
const longestFence = Math.max(0, ...[...code.matchAll(/`+/g)].map((match) => match[0].length));
|
|
9100
9107
|
const fence = "`".repeat(Math.max(3, longestFence + 1));
|
|
9101
9108
|
return `
|