@pinkpixel/marzipan 1.2.0 → 1.2.2
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 +2 -2
- package/dist/index-DNhI8UtW.js +31 -0
- package/dist/index-DNhI8UtW.js.map +1 -0
- package/dist/index-ZtRPyDzL.js +31 -0
- package/dist/index-ZtRPyDzL.js.map +1 -0
- package/dist/index.js +118 -141
- package/dist/index.js.map +1 -1
- package/dist/parser.d.ts.map +1 -1
- package/dist/parser.js +6 -10
- package/dist/parser.js.map +1 -1
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/tableGenerator.js +1 -1
- package/dist/plugins/tableGridPlugin.d.ts +1 -1
- package/dist/plugins/tableGridPlugin.d.ts.map +1 -1
- package/dist/plugins/tableGridPlugin.js +76 -87
- package/dist/plugins/tableGridPlugin.js.map +1 -1
- package/dist/plugins/tablePlugin.js +1 -1
- package/dist/plugins/utils/table.d.ts +2 -4
- package/dist/plugins/utils/table.d.ts.map +1 -1
- package/dist/plugins/utils/table.js +10 -13
- package/dist/plugins/utils/table.js.map +1 -1
- package/dist/styles.d.ts.map +1 -1
- package/dist/styles.js +46 -69
- package/dist/styles.js.map +1 -1
- package/dist/table-DkW9Xd6r.js +33 -0
- package/dist/table-DkW9Xd6r.js.map +1 -0
- package/dist/table-DtH1DJ20.js +31 -0
- package/dist/table-DtH1DJ20.js.map +1 -0
- package/docs/.vitepress/config.ts +1 -1
- package/docs/plugins.md +31 -41
- package/package.json +1 -1
|
@@ -11,26 +11,23 @@ export function buildTableMarkdown(rowsOrOpts, colsArg) {
|
|
|
11
11
|
const headers = opts.headers ?? Array.from({ length: safeCols }, (_, i) => `Header ${i + 1}`);
|
|
12
12
|
const alignment = opts.alignment ?? Array(safeCols).fill('left');
|
|
13
13
|
const headerRow = headers.slice(0, safeCols).map(h => h || ' ').join(' | ');
|
|
14
|
+
// Compute per-column widths so body rows match the header row width.
|
|
15
|
+
// This ensures clicks in the overlay correctly land inside cell text in the textarea.
|
|
16
|
+
const cellWidths = headers.slice(0, safeCols).map(h => Math.max(3, (h || ' ').length));
|
|
14
17
|
const divider = Array.from({ length: safeCols }, (_, i) => {
|
|
15
18
|
const align = alignment[i] ?? 'left';
|
|
19
|
+
const w = cellWidths[i];
|
|
16
20
|
if (align === 'center')
|
|
17
|
-
return '
|
|
21
|
+
return ':' + '-'.repeat(Math.max(1, w - 2)) + ':';
|
|
18
22
|
if (align === 'right')
|
|
19
|
-
return '
|
|
20
|
-
return '
|
|
23
|
+
return '-'.repeat(Math.max(2, w - 1)) + ':';
|
|
24
|
+
return '-'.repeat(w);
|
|
21
25
|
}).join(' | ');
|
|
22
|
-
const body = Array.from({ length: safeRows }, () =>
|
|
26
|
+
const body = Array.from({ length: safeRows }, () => cellWidths.map(w => ' '.repeat(w)).join(' | '))
|
|
23
27
|
.map((row) => `| ${row} |`)
|
|
24
28
|
.join('\n');
|
|
25
|
-
// Build annotation comment
|
|
26
|
-
|
|
27
|
-
const parts = [];
|
|
28
|
-
if (opts.style && opts.style !== 'default')
|
|
29
|
-
parts.push(`style=${opts.style}`);
|
|
30
|
-
if (opts.borderStyle && opts.borderStyle !== 'solid')
|
|
31
|
-
parts.push(`border=${opts.borderStyle}`);
|
|
32
|
-
if (parts.length)
|
|
33
|
-
annotation = `<!-- mz-table: ${parts.join(' ')} -->\n`;
|
|
29
|
+
// Build annotation comment when a non-default header color is chosen.
|
|
30
|
+
const annotation = opts.headerColor ? `<!-- mz-table: header=${opts.headerColor} -->\n` : '';
|
|
34
31
|
return `${annotation}| ${headerRow} |\n| ${divider} |\n${body}\n`;
|
|
35
32
|
}
|
|
36
33
|
export function resolvePositiveInteger(value, fallback) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.js","sourceRoot":"","sources":["../../../src/plugins/utils/table.ts"],"names":[],"mappings":"
|
|
1
|
+
{"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F,OAAO,GAAG,UAAU,KAAK,SAAS,SAAS,OAAO,OAAO,IAAI,IAAI,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,KAAoB,EAAE,QAAgB;IAC3E,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IAC/B,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC5C,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;QACvC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/styles.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AACA;;;GAGG;AAIH;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,GAAE,GAAQ,
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AACA;;;GAGG;AAIH;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,GAAE,GAAQ,UA+3B/C"}
|
package/dist/styles.js
CHANGED
|
@@ -796,42 +796,71 @@ export function generateStyles(options = {}) {
|
|
|
796
796
|
height: 2px !important;
|
|
797
797
|
}
|
|
798
798
|
|
|
799
|
-
/*
|
|
799
|
+
/* ──────────────────────────────────────────────────────────────────
|
|
800
|
+
* TABLES
|
|
801
|
+
*
|
|
802
|
+
* Strategy: in edit mode the raw pipe lines (table-row, table-separator,
|
|
803
|
+
* mz-table-annotation) stay as plain <div> text lines — perfectly
|
|
804
|
+
* line-aligned with the textarea because they are just text. The
|
|
805
|
+
* postProcessHTML assembles a real <table> in the DOM alongside those
|
|
806
|
+
* divs, but we hide the <table> in edit mode and show only the raw lines.
|
|
807
|
+
* In preview mode we flip: hide the raw lines, show the <table>.
|
|
808
|
+
* ────────────────────────────────────────────────────────────────── */
|
|
809
|
+
|
|
810
|
+
/* Edit mode: hide the rendered <table>, show the raw lines */
|
|
811
|
+
.marzipan-container:not(.preview-mode) .marzipan-preview .marzipan-table {
|
|
812
|
+
display: none !important;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
/* Edit mode: dim annotation comment and separator so they look secondary */
|
|
816
|
+
.marzipan-container:not(.preview-mode) .marzipan-preview .mz-table-annotation,
|
|
817
|
+
.marzipan-container:not(.preview-mode) .marzipan-preview .table-separator {
|
|
818
|
+
opacity: 0.45 !important;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
/* Preview mode: hide raw pipe lines, show the <table> */
|
|
822
|
+
.marzipan-container.preview-mode .marzipan-preview .table-row,
|
|
823
|
+
.marzipan-container.preview-mode .marzipan-preview .table-separator,
|
|
824
|
+
.marzipan-container.preview-mode .marzipan-preview .mz-table-annotation {
|
|
825
|
+
display: none !important;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
/* ── Rendered table styles (preview mode only) ── */
|
|
800
829
|
.marzipan-preview .marzipan-table {
|
|
801
830
|
border-collapse: collapse !important;
|
|
802
|
-
margin:
|
|
831
|
+
margin: 0.5em 0 !important;
|
|
803
832
|
width: auto !important;
|
|
804
|
-
overflow: auto !important;
|
|
805
833
|
display: table !important;
|
|
806
834
|
}
|
|
807
|
-
|
|
835
|
+
|
|
808
836
|
.marzipan-preview .marzipan-table th,
|
|
809
837
|
.marzipan-preview .marzipan-table td {
|
|
810
838
|
border: 1px solid var(--border, rgba(128,128,128,0.4)) !important;
|
|
811
|
-
padding: 0.
|
|
839
|
+
padding: 0.5em 1em !important;
|
|
812
840
|
text-align: left !important;
|
|
813
841
|
}
|
|
814
|
-
|
|
842
|
+
|
|
815
843
|
.marzipan-preview .marzipan-table th {
|
|
816
844
|
background: var(--bg-secondary, rgba(128,128,128,0.15)) !important;
|
|
817
845
|
font-weight: 600 !important;
|
|
846
|
+
padding: 0.65em 1em !important;
|
|
818
847
|
}
|
|
819
|
-
|
|
848
|
+
|
|
820
849
|
.marzipan-preview .marzipan-table tr:nth-child(even) td {
|
|
821
850
|
background: var(--bg-secondary, rgba(128,128,128,0.05)) !important;
|
|
822
851
|
}
|
|
823
|
-
|
|
852
|
+
|
|
824
853
|
.marzipan-preview .marzipan-table thead,
|
|
825
854
|
.marzipan-preview .marzipan-table tbody,
|
|
826
855
|
.marzipan-preview .marzipan-table tr {
|
|
827
856
|
display: table-row-group !important;
|
|
828
857
|
}
|
|
829
|
-
|
|
858
|
+
|
|
830
859
|
.marzipan-preview .marzipan-table tr {
|
|
831
860
|
display: table-row !important;
|
|
832
861
|
}
|
|
833
862
|
|
|
834
|
-
/*
|
|
863
|
+
/* Column alignment */
|
|
835
864
|
.marzipan-preview .marzipan-table th[style*="text-align: center"],
|
|
836
865
|
.marzipan-preview .marzipan-table td[style*="text-align: center"] {
|
|
837
866
|
text-align: center !important;
|
|
@@ -841,65 +870,13 @@ export function generateStyles(options = {}) {
|
|
|
841
870
|
text-align: right !important;
|
|
842
871
|
}
|
|
843
872
|
|
|
844
|
-
/*
|
|
845
|
-
.marzipan-preview .marzipan-table.mz-
|
|
846
|
-
|
|
847
|
-
}
|
|
848
|
-
.marzipan-preview .marzipan-table.mz-
|
|
849
|
-
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
.marzipan-preview .marzipan-table.mz-table-rainbow tr:nth-child(even) td { background: transparent !important; }
|
|
853
|
-
.marzipan-preview .marzipan-table.mz-table-rainbow tbody tr:nth-child(6n+1) td { background: rgba(236,72,153,0.10) !important; }
|
|
854
|
-
.marzipan-preview .marzipan-table.mz-table-rainbow tbody tr:nth-child(6n+2) td { background: rgba(139,92,246,0.10) !important; }
|
|
855
|
-
.marzipan-preview .marzipan-table.mz-table-rainbow tbody tr:nth-child(6n+3) td { background: rgba(6,182,212,0.10) !important; }
|
|
856
|
-
.marzipan-preview .marzipan-table.mz-table-rainbow tbody tr:nth-child(6n+4) td { background: rgba(16,185,129,0.10) !important; }
|
|
857
|
-
.marzipan-preview .marzipan-table.mz-table-rainbow tbody tr:nth-child(6n+5) td { background: rgba(245,158,11,0.10) !important; }
|
|
858
|
-
.marzipan-preview .marzipan-table.mz-table-rainbow tbody tr:nth-child(6n+6) td { background: rgba(59,130,246,0.10) !important; }
|
|
859
|
-
.marzipan-preview .marzipan-table.mz-table-rainbow th {
|
|
860
|
-
background: rgba(236,72,153,0.18) !important;
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
.marzipan-preview .marzipan-table.mz-table-minimal {
|
|
864
|
-
border: none !important;
|
|
865
|
-
}
|
|
866
|
-
.marzipan-preview .marzipan-table.mz-table-minimal th,
|
|
867
|
-
.marzipan-preview .marzipan-table.mz-table-minimal td {
|
|
868
|
-
border: none !important;
|
|
869
|
-
border-bottom: 1px solid var(--border, rgba(128,128,128,0.25)) !important;
|
|
870
|
-
}
|
|
871
|
-
.marzipan-preview .marzipan-table.mz-table-minimal th {
|
|
872
|
-
border-bottom: 2px solid var(--border, rgba(128,128,128,0.5)) !important;
|
|
873
|
-
background: transparent !important;
|
|
874
|
-
}
|
|
875
|
-
.marzipan-preview .marzipan-table.mz-table-minimal tr:nth-child(even) td {
|
|
876
|
-
background: transparent !important;
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
/* Table border style presets */
|
|
880
|
-
.marzipan-preview .marzipan-table.mz-border-dashed th,
|
|
881
|
-
.marzipan-preview .marzipan-table.mz-border-dashed td {
|
|
882
|
-
border-style: dashed !important;
|
|
883
|
-
}
|
|
884
|
-
.marzipan-preview .marzipan-table.mz-border-dotted th,
|
|
885
|
-
.marzipan-preview .marzipan-table.mz-border-dotted td {
|
|
886
|
-
border-style: dotted !important;
|
|
887
|
-
}
|
|
888
|
-
.marzipan-preview .marzipan-table.mz-border-double th,
|
|
889
|
-
.marzipan-preview .marzipan-table.mz-border-double td {
|
|
890
|
-
border-style: double !important;
|
|
891
|
-
border-width: 3px !important;
|
|
892
|
-
}
|
|
893
|
-
.marzipan-preview .marzipan-table.mz-border-none th,
|
|
894
|
-
.marzipan-preview .marzipan-table.mz-border-none td {
|
|
895
|
-
border-color: transparent !important;
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
/* In preview mode - hide table syntax markers */
|
|
899
|
-
.marzipan-container.preview-mode .marzipan-wrapper .marzipan-preview .table-row,
|
|
900
|
-
.marzipan-container.preview-mode .marzipan-wrapper .marzipan-preview .table-separator {
|
|
901
|
-
display: none !important;
|
|
902
|
-
}
|
|
873
|
+
/* Header color options */
|
|
874
|
+
.marzipan-preview .marzipan-table.mz-header-pink th { background: rgba(236,72,153,0.22) !important; }
|
|
875
|
+
.marzipan-preview .marzipan-table.mz-header-purple th { background: rgba(139,92,246,0.22) !important; }
|
|
876
|
+
.marzipan-preview .marzipan-table.mz-header-blue th { background: rgba(59,130,246,0.22) !important; }
|
|
877
|
+
.marzipan-preview .marzipan-table.mz-header-cyan th { background: rgba(6,182,212,0.22) !important; }
|
|
878
|
+
.marzipan-preview .marzipan-table.mz-header-green th { background: rgba(16,185,129,0.22) !important; }
|
|
879
|
+
.marzipan-preview .marzipan-table.mz-header-amber th { background: rgba(245,158,11,0.22) !important; }
|
|
903
880
|
|
|
904
881
|
/* Images - responsive and styled */
|
|
905
882
|
.marzipan-preview .marzipan-image {
|
package/dist/styles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA,cAAc;AACd;;;GAGG;AAEH,OAAO,EAAE,cA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAmmB3B,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAiCV,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA2HzB,YAAY;GACf,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
function b(r, o) {
|
|
2
|
+
let e;
|
|
3
|
+
typeof r == "number" ? e = { rows: r, cols: o ?? 2 } : e = r;
|
|
4
|
+
const n = Math.max(1, Math.floor(e.rows)), a = Math.max(1, Math.floor(e.cols)), m = e.headers ?? Array.from({ length: a }, (t, l) => `Header ${l + 1}`), d = e.alignment ?? Array(a).fill("left"), u = m.slice(0, a).map((t) => t || " ").join(" | "), f = m.slice(0, a).map((t) => Math.max(3, (t || " ").length)), p = Array.from({ length: a }, (t, l) => {
|
|
5
|
+
const c = d[l] ?? "left", i = f[l];
|
|
6
|
+
return c === "center" ? ":" + "-".repeat(Math.max(1, i - 2)) + ":" : c === "right" ? "-".repeat(Math.max(2, i - 1)) + ":" : "-".repeat(i);
|
|
7
|
+
}).join(" | "), y = Array.from(
|
|
8
|
+
{ length: n },
|
|
9
|
+
() => f.map((t) => " ".repeat(t)).join(" | ")
|
|
10
|
+
).map((t) => `| ${t} |`).join(`
|
|
11
|
+
`);
|
|
12
|
+
let h = "";
|
|
13
|
+
const s = [];
|
|
14
|
+
return e.style && e.style !== "default" && s.push(`style=${e.style}`), e.borderStyle && e.borderStyle !== "solid" && s.push(`border=${e.borderStyle}`), s.length && (h = `<!-- mz-table: ${s.join(" ")} -->
|
|
15
|
+
`), `${h}| ${u} |
|
|
16
|
+
| ${p} |
|
|
17
|
+
${y}
|
|
18
|
+
`;
|
|
19
|
+
}
|
|
20
|
+
function g(r, o) {
|
|
21
|
+
if (r === null)
|
|
22
|
+
return null;
|
|
23
|
+
const e = r.trim();
|
|
24
|
+
if (!e)
|
|
25
|
+
return Math.max(1, o);
|
|
26
|
+
const n = Number.parseInt(e, 10);
|
|
27
|
+
return Number.isNaN(n) || n < 1 ? Math.max(1, o) : n;
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
b,
|
|
31
|
+
g as r
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=table-DkW9Xd6r.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-DkW9Xd6r.js","sources":["../src/plugins/utils/table.ts"],"sourcesContent":["export type ColumnAlignment = 'left' | 'center' | 'right';\nexport type TableStyle = 'default' | 'striped' | 'rainbow' | 'minimal';\nexport type BorderStyle = 'solid' | 'dashed' | 'dotted' | 'double' | 'none';\n\nexport interface TableBuildOptions {\n rows: number;\n cols: number;\n headers?: string[];\n alignment?: ColumnAlignment[];\n style?: TableStyle;\n borderStyle?: BorderStyle;\n}\n\nexport function buildTableMarkdown(rowsOrOpts: number | TableBuildOptions, colsArg?: number): string {\n let opts: TableBuildOptions;\n if (typeof rowsOrOpts === 'number') {\n opts = { rows: rowsOrOpts, cols: colsArg ?? 2 };\n } else {\n opts = rowsOrOpts;\n }\n\n const safeRows = Math.max(1, Math.floor(opts.rows));\n const safeCols = Math.max(1, Math.floor(opts.cols));\n const headers = opts.headers ?? Array.from({ length: safeCols }, (_, i) => `Header ${i + 1}`);\n const alignment = opts.alignment ?? Array(safeCols).fill('left' as ColumnAlignment);\n\n const headerRow = headers.slice(0, safeCols).map(h => h || ' ').join(' | ');\n\n // Compute per-column widths so body rows match the header row width.\n // This ensures clicks in the overlay correctly land inside cell text in the textarea.\n const cellWidths = headers.slice(0, safeCols).map(h => Math.max(3, (h || ' ').length));\n\n const divider = Array.from({ length: safeCols }, (_, i) => {\n const align = alignment[i] ?? 'left';\n const w = cellWidths[i];\n if (align === 'center') return ':' + '-'.repeat(Math.max(1, w - 2)) + ':';\n if (align === 'right') return '-'.repeat(Math.max(2, w - 1)) + ':';\n return '-'.repeat(w);\n }).join(' | ');\n\n const body = Array.from({ length: safeRows }, () =>\n cellWidths.map(w => ' '.repeat(w)).join(' | '),\n )\n .map((row) => `| ${row} |`)\n .join('\\n');\n\n // Build annotation comment for non-default styles\n let annotation = '';\n const parts: string[] = [];\n if (opts.style && opts.style !== 'default') parts.push(`style=${opts.style}`);\n if (opts.borderStyle && opts.borderStyle !== 'solid') parts.push(`border=${opts.borderStyle}`);\n if (parts.length) annotation = `<!-- mz-table: ${parts.join(' ')} -->\\n`;\n\n return `${annotation}| ${headerRow} |\\n| ${divider} |\\n${body}\\n`;\n}\n\nexport function resolvePositiveInteger(value: string | null, fallback: number): number | null {\n if (value === null) {\n return null;\n }\n\n const trimmed = value.trim();\n if (!trimmed) {\n return Math.max(1, fallback);\n }\n\n const parsed = Number.parseInt(trimmed, 10);\n if (Number.isNaN(parsed) || parsed < 1) {\n return Math.max(1, fallback);\n }\n\n return parsed;\n}\n"],"names":["buildTableMarkdown","rowsOrOpts","colsArg","opts","safeRows","safeCols","headers","_","i","alignment","headerRow","h","cellWidths","divider","align","w","body","row","annotation","parts","resolvePositiveInteger","value","fallback","trimmed","parsed"],"mappings":"AAaO,SAASA,EAAmBC,GAAwCC,GAA0B;AACnG,MAAIC;AACJ,EAAI,OAAOF,KAAe,WACxBE,IAAO,EAAE,MAAMF,GAAY,MAAMC,KAAW,EAAA,IAE5CC,IAAOF;AAGT,QAAMG,IAAW,KAAK,IAAI,GAAG,KAAK,MAAMD,EAAK,IAAI,CAAC,GAC5C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AM,WAAQD,IAAa,kBAAkBC,EAAM,KAAK,GAAG,CAAC;AAAA,IAEzD,GAAGD,CAAU,KAAKR,CAAS;AAAA,IAASG,CAAO;AAAA,EAAOG,CAAI;AAAA;AAC/D;AAEO,SAASI,EAAuBC,GAAsBC,GAAiC;AAC5F,MAAID,MAAU;AACZ,WAAO;AAGT,QAAME,IAAUF,EAAM,KAAA;AACtB,MAAI,CAACE;AACH,WAAO,KAAK,IAAI,GAAGD,CAAQ;AAG7B,QAAME,IAAS,OAAO,SAASD,GAAS,EAAE;AAC1C,SAAI,OAAO,MAAMC,CAAM,KAAKA,IAAS,IAC5B,KAAK,IAAI,GAAGF,CAAQ,IAGtBE;AACT;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
function M(r, o) {
|
|
2
|
+
let e;
|
|
3
|
+
typeof r == "number" ? e = { rows: r, cols: o ?? 2 } : e = r;
|
|
4
|
+
const n = Math.max(1, Math.floor(e.rows)), a = Math.max(1, Math.floor(e.cols)), l = e.headers ?? Array.from({ length: a }, (t, s) => `Header ${s + 1}`), c = e.alignment ?? Array(a).fill("left"), f = l.slice(0, a).map((t) => t || " ").join(" | "), m = l.slice(0, a).map((t) => Math.max(3, (t || " ").length)), d = Array.from({ length: a }, (t, s) => {
|
|
5
|
+
const h = c[s] ?? "left", i = m[s];
|
|
6
|
+
return h === "center" ? ":" + "-".repeat(Math.max(1, i - 2)) + ":" : h === "right" ? "-".repeat(Math.max(2, i - 1)) + ":" : "-".repeat(i);
|
|
7
|
+
}).join(" | "), u = Array.from(
|
|
8
|
+
{ length: n },
|
|
9
|
+
() => m.map((t) => " ".repeat(t)).join(" | ")
|
|
10
|
+
).map((t) => `| ${t} |`).join(`
|
|
11
|
+
`);
|
|
12
|
+
return `${e.headerColor ? `<!-- mz-table: header=${e.headerColor} -->
|
|
13
|
+
` : ""}| ${f} |
|
|
14
|
+
| ${d} |
|
|
15
|
+
${u}
|
|
16
|
+
`;
|
|
17
|
+
}
|
|
18
|
+
function g(r, o) {
|
|
19
|
+
if (r === null)
|
|
20
|
+
return null;
|
|
21
|
+
const e = r.trim();
|
|
22
|
+
if (!e)
|
|
23
|
+
return Math.max(1, o);
|
|
24
|
+
const n = Number.parseInt(e, 10);
|
|
25
|
+
return Number.isNaN(n) || n < 1 ? Math.max(1, o) : n;
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
M as b,
|
|
29
|
+
g as r
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=table-DtH1DJ20.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-DtH1DJ20.js","sources":["../src/plugins/utils/table.ts"],"sourcesContent":["export type ColumnAlignment = 'left' | 'center' | 'right';\n\nexport interface TableBuildOptions {\n rows: number;\n cols: number;\n headers?: string[];\n alignment?: ColumnAlignment[];\n /** Optional header row color, e.g. 'pink' | 'purple' | 'blue' | 'cyan' | 'green' | 'amber' */\n headerColor?: string;\n}\n\nexport function buildTableMarkdown(rowsOrOpts: number | TableBuildOptions, colsArg?: number): string {\n let opts: TableBuildOptions;\n if (typeof rowsOrOpts === 'number') {\n opts = { rows: rowsOrOpts, cols: colsArg ?? 2 };\n } else {\n opts = rowsOrOpts;\n }\n\n const safeRows = Math.max(1, Math.floor(opts.rows));\n const safeCols = Math.max(1, Math.floor(opts.cols));\n const headers = opts.headers ?? Array.from({ length: safeCols }, (_, i) => `Header ${i + 1}`);\n const alignment = opts.alignment ?? Array(safeCols).fill('left' as ColumnAlignment);\n\n const headerRow = headers.slice(0, safeCols).map(h => h || ' ').join(' | ');\n\n // Compute per-column widths so body rows match the header row width.\n // This ensures clicks in the overlay correctly land inside cell text in the textarea.\n const cellWidths = headers.slice(0, safeCols).map(h => Math.max(3, (h || ' ').length));\n\n const divider = Array.from({ length: safeCols }, (_, i) => {\n const align = alignment[i] ?? 'left';\n const w = cellWidths[i];\n if (align === 'center') return ':' + '-'.repeat(Math.max(1, w - 2)) + ':';\n if (align === 'right') return '-'.repeat(Math.max(2, w - 1)) + ':';\n return '-'.repeat(w);\n }).join(' | ');\n\n const body = Array.from({ length: safeRows }, () =>\n cellWidths.map(w => ' '.repeat(w)).join(' | '),\n )\n .map((row) => `| ${row} |`)\n .join('\\n');\n\n // Build annotation comment when a non-default header color is chosen.\n const annotation = opts.headerColor ? `<!-- mz-table: header=${opts.headerColor} -->\\n` : '';\n\n return `${annotation}| ${headerRow} |\\n| ${divider} |\\n${body}\\n`;\n}\n\nexport function resolvePositiveInteger(value: string | null, fallback: number): number | null {\n if (value === null) {\n return null;\n }\n\n const trimmed = value.trim();\n if (!trimmed) {\n return Math.max(1, fallback);\n }\n\n const parsed = Number.parseInt(trimmed, 10);\n if (Number.isNaN(parsed) || parsed < 1) {\n return Math.max(1, fallback);\n }\n\n return parsed;\n}\n"],"names":["buildTableMarkdown","rowsOrOpts","colsArg","opts","safeRows","safeCols","headers","_","i","alignment","headerRow","h","cellWidths","divider","align","w","body","row","resolvePositiveInteger","value","fallback","trimmed","parsed"],"mappings":"AAWO,SAASA,EAAmBC,GAAwCC,GAA0B;AACnG,MAAIC;AACJ,EAAI,OAAOF,KAAe,WACxBE,IAAO,EAAE,MAAMF,GAAY,MAAMC,KAAW,EAAA,IAE5CC,IAAOF;AAGT,QAAMG,IAAW,KAAK,IAAI,GAAG,KAAK,MAAMD,EAAK,IAAI,CAAC,GAC5CE,IAAW,KAAK,IAAI,GAAG,KAAK,MAAMF,EAAK,IAAI,CAAC,GAC5CG,IAAUH,EAAK,WAAW,MAAM,KAAK,EAAE,QAAQE,EAAA,GAAY,CAACE,GAAGC,MAAM,UAAUA,IAAI,CAAC,EAAE,GACtFC,IAAYN,EAAK,aAAa,MAAME,CAAQ,EAAE,KAAK,MAAyB,GAE5EK,IAAYJ,EAAQ,MAAM,GAAGD,CAAQ,EAAE,IAAI,CAAAM,MAAKA,KAAK,GAAG,EAAE,KAAK,KAAK,GAIpEC,IAAaN,EAAQ,MAAM,GAAGD,CAAQ,EAAE,IAAI,C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: 'v1.
|
|
34
|
+
text: 'v1.2.2',
|
|
35
35
|
items: [
|
|
36
36
|
{ text: 'Changelog', link: 'https://github.com/pinkpixel-dev/marzipan/blob/main/CHANGELOG.md' },
|
|
37
37
|
]
|
package/docs/plugins.md
CHANGED
|
@@ -52,7 +52,7 @@ Every factory returns an object that Marzipan consumes internally. You can mix a
|
|
|
52
52
|
| `mermaidPlugin` | `@pinkpixel/marzipan/plugins/mermaidPlugin` | Lazy-loads Mermaid from npm/ESM and renders diagrams inline. |
|
|
53
53
|
| `mermaidExternalPlugin` | `@pinkpixel/marzipan/plugins/mermaidExternal` | Mermaid integration that targets a CDN script tag—perfect for sandboxed playgrounds. |
|
|
54
54
|
| `tablePlugin` | `@pinkpixel/marzipan/plugins/tablePlugin` | Toolbar-driven table generator with inline editing controls. |
|
|
55
|
-
| `tableGridPlugin` | `@pinkpixel/marzipan/plugins/tableGridPlugin` | Grid popover with alignment
|
|
55
|
+
| `tableGridPlugin` | `@pinkpixel/marzipan/plugins/tableGridPlugin` | Grid popover with alignment and header color options (exports `tableGridStyles`). |
|
|
56
56
|
| `tableGeneratorPlugin` | `@pinkpixel/marzipan/plugins/tableGenerator` | Quick GFM table inserter with prompt-driven sizing. |
|
|
57
57
|
| `tinyHighlightPlugin` | `@pinkpixel/marzipan/plugins/tinyHighlight` | Zero-runtime syntax highlighting for fenced code blocks (`tinyHighlightStyles` helper available). |
|
|
58
58
|
|
|
@@ -60,81 +60,71 @@ Every factory returns an object that Marzipan consumes internally. You can mix a
|
|
|
60
60
|
|
|
61
61
|
## Table Plugin Enhancements
|
|
62
62
|
|
|
63
|
-
The table plugins
|
|
63
|
+
The table plugins support GFM alignment markers and an optional header color annotation.
|
|
64
64
|
|
|
65
65
|
### Column Alignment
|
|
66
66
|
|
|
67
67
|
GFM column alignment is fully supported. Use `:---` (left), `:---:` (center), or `---:` (right) in the separator row:
|
|
68
68
|
|
|
69
69
|
```markdown
|
|
70
|
-
| Left
|
|
71
|
-
|
|
|
72
|
-
| A
|
|
70
|
+
| Left | Center | Right |
|
|
71
|
+
| :--- | :----: | ----: |
|
|
72
|
+
| A | B | C |
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
The `tableGridPlugin` popover includes alignment buttons (Left / Center / Right) that set the alignment for all columns.
|
|
76
76
|
|
|
77
|
-
###
|
|
77
|
+
### Header Color
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
The `tableGridPlugin` popover includes a **Header Color** row with six pastel swatches plus a “none” option:
|
|
80
80
|
|
|
81
|
-
|
|
|
82
|
-
|
|
|
83
|
-
| `
|
|
84
|
-
| `
|
|
85
|
-
| `
|
|
86
|
-
| `
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
Border styles are set via the `border=<style>` annotation parameter:
|
|
91
|
-
|
|
92
|
-
| Style | Description |
|
|
93
|
-
| -------- | ------------------------------------ |
|
|
94
|
-
| `solid` | Standard solid borders (default). |
|
|
95
|
-
| `dashed` | Dashed cell borders. |
|
|
96
|
-
| `dotted` | Dotted cell borders. |
|
|
97
|
-
| `double` | Double-line cell borders. |
|
|
98
|
-
| `none` | No visible borders. |
|
|
81
|
+
| Color value | Appearance |
|
|
82
|
+
| ----------- | ---------------------------- |
|
|
83
|
+
| `pink` | Soft pink header background |
|
|
84
|
+
| `purple` | Muted purple background |
|
|
85
|
+
| `blue` | Light blue background |
|
|
86
|
+
| `cyan` | Aqua/teal background |
|
|
87
|
+
| `green` | Sage green background |
|
|
88
|
+
| `amber` | Warm amber/yellow background |
|
|
89
|
+
| _(none)_ | No color — plain header |
|
|
99
90
|
|
|
100
91
|
### Annotation Syntax
|
|
101
92
|
|
|
102
|
-
Place a hidden HTML comment immediately before the table to apply
|
|
93
|
+
Place a hidden HTML comment immediately before the table to apply a header color:
|
|
103
94
|
|
|
104
95
|
```markdown
|
|
105
|
-
<!-- mz-table:
|
|
106
|
-
|
|
107
|
-
|
|
|
108
|
-
|
|
|
109
|
-
|
|
|
96
|
+
<!-- mz-table: header=purple -->
|
|
97
|
+
|
|
98
|
+
| Name | Score |
|
|
99
|
+
| ----- | ----- |
|
|
100
|
+
| Alice | 95 |
|
|
101
|
+
| Bob | 87 |
|
|
110
102
|
```
|
|
111
103
|
|
|
112
|
-
The comment is invisible to standard markdown renderers and only parsed by Marzipan.
|
|
104
|
+
The comment is invisible to standard markdown renderers and is only parsed by Marzipan. In edit mode the raw pipe-text lines are shown directly in the overlay (preserving pixel-perfect cursor alignment); the styled `<table>` is rendered only in preview mode.
|
|
113
105
|
|
|
114
106
|
### `tableGridPlugin` Popover
|
|
115
107
|
|
|
116
|
-
The grid popover
|
|
108
|
+
The grid popover includes an options panel below the size grid with:
|
|
117
109
|
|
|
118
110
|
- **Align** – Left / Center / Right toggle buttons.
|
|
119
|
-
- **
|
|
120
|
-
- **Border** – Solid / Dashed / Dotted / Double / None options.
|
|
111
|
+
- **Header color** – Six pastel color swatches plus a “none” dot.
|
|
121
112
|
|
|
122
113
|
Preferences are persisted to `localStorage` (key `marzipan.table.prefs`) so they survive page reloads.
|
|
123
114
|
|
|
124
115
|
### `buildTableMarkdown` Utility
|
|
125
116
|
|
|
126
|
-
The `buildTableMarkdown()` helper (exported from `@pinkpixel/marzipan
|
|
117
|
+
The `buildTableMarkdown()` helper (exported from `@pinkpixel/marzipan`) accepts a `TableBuildOptions` object:
|
|
127
118
|
|
|
128
119
|
```ts
|
|
129
|
-
import { buildTableMarkdown } from
|
|
130
|
-
import type { TableBuildOptions } from
|
|
120
|
+
import { buildTableMarkdown } from "@pinkpixel/marzipan";
|
|
121
|
+
import type { TableBuildOptions } from "@pinkpixel/marzipan";
|
|
131
122
|
|
|
132
123
|
const md = buildTableMarkdown({
|
|
133
124
|
rows: 3,
|
|
134
125
|
cols: 4,
|
|
135
|
-
alignment: [
|
|
136
|
-
|
|
137
|
-
borderStyle: 'dashed',
|
|
126
|
+
alignment: ["left", "center", "right", "left"],
|
|
127
|
+
headerColor: "blue",
|
|
138
128
|
});
|
|
139
129
|
```
|
|
140
130
|
|