@verbaly/compiler 0.23.0 → 0.24.0
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/README.md +1 -1
- package/dist/claude-C-ETlqsW.js.map +1 -1
- package/dist/cli.js +6 -7
- package/dist/cli.js.map +1 -1
- package/dist/index.js +6 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { parse } from "@babel/parser";
|
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, watch, writeFileSync } from "node:fs";
|
|
4
4
|
import { basename, dirname, join, relative, resolve } from "node:path";
|
|
5
|
-
import { RICH_TAGS, createVerbaly, parse as parse$1, parseTags,
|
|
5
|
+
import { RICH_TAGS, createVerbaly, normalizeLink, parse as parse$1, parseTags, safeAttribute } from "verbaly";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
|
7
7
|
import MagicString from "magic-string";
|
|
8
8
|
import { glob } from "tinyglobby";
|
|
@@ -1574,12 +1574,13 @@ function renderHtml(html, options) {
|
|
|
1574
1574
|
if (attrMapRaw !== void 0) {
|
|
1575
1575
|
const map = parseArgs(attrMapRaw);
|
|
1576
1576
|
if (map) for (const [name, attrKey] of Object.entries(map)) {
|
|
1577
|
-
if (typeof attrKey !== "string"
|
|
1577
|
+
if (typeof attrKey !== "string") continue;
|
|
1578
1578
|
if (!v.has(attrKey)) {
|
|
1579
1579
|
missing.add(attrKey);
|
|
1580
1580
|
continue;
|
|
1581
1581
|
}
|
|
1582
|
-
|
|
1582
|
+
const value = safeAttribute(name, t(attrKey, args));
|
|
1583
|
+
if (value !== void 0) setAttribute(ms, html, chunkStart, openEnd, attrChunk, name, value);
|
|
1583
1584
|
}
|
|
1584
1585
|
}
|
|
1585
1586
|
}
|
|
@@ -1741,10 +1742,8 @@ function richToHtml(nodes, allowed, links) {
|
|
|
1741
1742
|
let out = "";
|
|
1742
1743
|
for (const node of nodes) if (typeof node === "string") out += escapeHtml(node);
|
|
1743
1744
|
else if (links?.[node.name] !== void 0) {
|
|
1744
|
-
const
|
|
1745
|
-
|
|
1746
|
-
const safe = safeHref(href);
|
|
1747
|
-
let attrs = safe !== void 0 ? ` href="${escapeAttr(safe)}"` : "";
|
|
1745
|
+
const { href, target, rel } = normalizeLink(links[node.name]);
|
|
1746
|
+
let attrs = href !== void 0 ? ` href="${escapeAttr(href)}"` : "";
|
|
1748
1747
|
if (target) attrs += ` target="${escapeAttr(target)}"`;
|
|
1749
1748
|
if (rel) attrs += ` rel="${escapeAttr(rel)}"`;
|
|
1750
1749
|
out += `<a${attrs}>${richToHtml(node.children, allowed, links)}</a>`;
|