@eldrajs/rich-text 0.1.0 → 0.1.1
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/CHANGELOG.md +5 -0
- package/dist/index.js +13 -13
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
Hand-maintained: every change a consumer can see gets a line under Unreleased in the same change.
|
|
4
4
|
Release-please writes the generated notes from commit messages and does not replace this.
|
|
5
5
|
|
|
6
|
+
## Unreleased
|
|
7
|
+
|
|
8
|
+
- Tree-shakes: importing only `safeImageSrc` (or another URL helper) no longer bundles the HTML
|
|
9
|
+
renderer and the embed host list, 4.3 kB down to 235 B minified. No behaviour change.
|
|
10
|
+
|
|
6
11
|
## 0.1.0 — 2026-09-15
|
|
7
12
|
|
|
8
13
|
- First release, moved out of `@eldra-is/vue-ui-components`. The document types are declared here
|
package/dist/index.js
CHANGED
|
@@ -816,15 +816,15 @@ const renderEmbed = (node, _children, _context, extra) => {
|
|
|
816
816
|
}, iframe, extra);
|
|
817
817
|
};
|
|
818
818
|
const defaultNodes = {
|
|
819
|
-
paragraph: wrap("p"),
|
|
819
|
+
paragraph: /* @__PURE__ */ wrap("p"),
|
|
820
820
|
heading: (node, children, _context, extra) => {
|
|
821
821
|
const raw = Number(node.attrs?.level);
|
|
822
822
|
return element(`h${Number.isInteger(raw) && raw >= 1 && raw <= 6 ? raw : 2}`, {}, children, extra);
|
|
823
823
|
},
|
|
824
|
-
blockquote: wrap("blockquote"),
|
|
825
|
-
bulletList: wrap("ul"),
|
|
824
|
+
blockquote: /* @__PURE__ */ wrap("blockquote"),
|
|
825
|
+
bulletList: /* @__PURE__ */ wrap("ul"),
|
|
826
826
|
orderedList: (node, children, _context, extra) => element("ol", { start: typeof node.attrs?.start === "number" ? node.attrs.start : void 0 }, children, extra),
|
|
827
|
-
listItem: wrap("li"),
|
|
827
|
+
listItem: /* @__PURE__ */ wrap("li"),
|
|
828
828
|
horizontalRule: (_node, _children, _context, extra) => element("hr", {}, "", extra),
|
|
829
829
|
hardBreak: () => "<br>",
|
|
830
830
|
codeBlock: (node, children, _context, extra) => {
|
|
@@ -842,9 +842,9 @@ const defaultNodes = {
|
|
|
842
842
|
const body = rows.slice(headerCount).map(context.render).join("");
|
|
843
843
|
return element("table", {}, (head ? element("thead", {}, head) : "") + (body ? element("tbody", {}, body) : ""), extra);
|
|
844
844
|
},
|
|
845
|
-
tableRow: wrap("tr"),
|
|
846
|
-
tableHeader: wrap("th"),
|
|
847
|
-
tableCell: wrap("td"),
|
|
845
|
+
tableRow: /* @__PURE__ */ wrap("tr"),
|
|
846
|
+
tableHeader: /* @__PURE__ */ wrap("th"),
|
|
847
|
+
tableCell: /* @__PURE__ */ wrap("td"),
|
|
848
848
|
image: (node, _children, _context, extra) => {
|
|
849
849
|
const attrs = node.attrs ?? {};
|
|
850
850
|
const src = safeImageSrc(attrs.src);
|
|
@@ -861,12 +861,12 @@ const defaultNodes = {
|
|
|
861
861
|
embed: renderEmbed
|
|
862
862
|
};
|
|
863
863
|
const defaultMarks = {
|
|
864
|
-
bold: wrapMark("strong"),
|
|
865
|
-
italic: wrapMark("em"),
|
|
866
|
-
strike: wrapMark("s"),
|
|
867
|
-
underline: wrapMark("u"),
|
|
868
|
-
code: wrapMark("code"),
|
|
869
|
-
highlight: wrapMark("mark"),
|
|
864
|
+
bold: /* @__PURE__ */ wrapMark("strong"),
|
|
865
|
+
italic: /* @__PURE__ */ wrapMark("em"),
|
|
866
|
+
strike: /* @__PURE__ */ wrapMark("s"),
|
|
867
|
+
underline: /* @__PURE__ */ wrapMark("u"),
|
|
868
|
+
code: /* @__PURE__ */ wrapMark("code"),
|
|
869
|
+
highlight: /* @__PURE__ */ wrapMark("mark"),
|
|
870
870
|
textStyle: (mark, children, _context, extra) => {
|
|
871
871
|
const color = safeCssColor(mark.attrs?.color);
|
|
872
872
|
if (!color && !extra.class && !extra.style) return children;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eldrajs/rich-text",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Framework-free rendering for Eldra CMS rich text: the document types, plain-text extraction, an escaping HTML serialiser, and embed normalisation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eldra",
|