@pinkpixel/marzipan 1.1.2 β 1.2.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/README.md +4 -5
- package/dist/index-CEbRSdyd.js +31 -0
- package/dist/index-CEbRSdyd.js.map +1 -0
- package/dist/index-xgEXHeDh.js +31 -0
- package/dist/index-xgEXHeDh.js.map +1 -0
- package/dist/index.d.ts +0 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +710 -620
- package/dist/index.js.map +1 -1
- package/dist/parser.d.ts +8 -1
- package/dist/parser.d.ts.map +1 -1
- package/dist/parser.js +63 -6
- package/dist/parser.js.map +1 -1
- package/dist/plugins/accentSwatchPlugin.d.ts.map +1 -1
- package/dist/plugins/accentSwatchPlugin.js +96 -80
- package/dist/plugins/accentSwatchPlugin.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 +24 -27
- package/dist/plugins/index.js.map +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 +143 -42
- package/dist/plugins/tableGridPlugin.js.map +1 -1
- package/dist/plugins/tablePlugin.js +1 -1
- package/dist/plugins/utils/table.d.ts +12 -1
- package/dist/plugins/utils/table.d.ts.map +1 -1
- package/dist/plugins/utils/table.js +31 -6
- package/dist/plugins/utils/table.js.map +1 -1
- package/dist/styles.d.ts.map +1 -1
- package/dist/styles.js +65 -1
- package/dist/styles.js.map +1 -1
- package/dist/table-CJHCBhPo.js +33 -0
- package/dist/table-CJHCBhPo.js.map +1 -0
- package/docs/index.md +2 -3
- package/docs/plugins.md +85 -7
- package/package.json +1 -1
package/dist/styles.js
CHANGED
|
@@ -800,7 +800,7 @@ export function generateStyles(options = {}) {
|
|
|
800
800
|
.marzipan-preview .marzipan-table {
|
|
801
801
|
border-collapse: collapse !important;
|
|
802
802
|
margin: 1em 0 !important;
|
|
803
|
-
width:
|
|
803
|
+
width: auto !important;
|
|
804
804
|
overflow: auto !important;
|
|
805
805
|
display: table !important;
|
|
806
806
|
}
|
|
@@ -830,6 +830,70 @@ export function generateStyles(options = {}) {
|
|
|
830
830
|
.marzipan-preview .marzipan-table tr {
|
|
831
831
|
display: table-row !important;
|
|
832
832
|
}
|
|
833
|
+
|
|
834
|
+
/* Table alignment (parsed from GFM :--- :---: ---: markers) */
|
|
835
|
+
.marzipan-preview .marzipan-table th[style*="text-align: center"],
|
|
836
|
+
.marzipan-preview .marzipan-table td[style*="text-align: center"] {
|
|
837
|
+
text-align: center !important;
|
|
838
|
+
}
|
|
839
|
+
.marzipan-preview .marzipan-table th[style*="text-align: right"],
|
|
840
|
+
.marzipan-preview .marzipan-table td[style*="text-align: right"] {
|
|
841
|
+
text-align: right !important;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
/* Table style presets */
|
|
845
|
+
.marzipan-preview .marzipan-table.mz-table-striped tr:nth-child(odd) td {
|
|
846
|
+
background: transparent !important;
|
|
847
|
+
}
|
|
848
|
+
.marzipan-preview .marzipan-table.mz-table-striped tr:nth-child(even) td {
|
|
849
|
+
background: var(--bg-secondary, rgba(128,128,128,0.08)) !important;
|
|
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
|
+
}
|
|
833
897
|
|
|
834
898
|
/* In preview mode - hide table syntax markers */
|
|
835
899
|
.marzipan-container.preview-mode .marzipan-wrapper .marzipan-preview .table-row,
|
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,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,UAAe,EAAE;IAC9C,MAAM,EACJ,QAAQ,GAAG,MAAM,EACjB,UAAU,GAAG,GAAG;IAChB,iFAAiF;IACjF,UAAU,GAAG,kNAAkN,EAC/N,OAAO,GAAG,MAAM,EAChB,KAAK,GAAG,IAAI,EACZ,MAAM,GAAG,EAAE,EACZ,GAAG,OAAO,CAAC;IAEZ,4BAA4B;IAC5B,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;;;;UAI9C,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;SACrB,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE;QACnB,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;QAC9D,OAAO,GAAG,OAAO,KAAK,GAAG,cAAc,CAAC;IAC1C,CAAC,CAAC;SACD,IAAI,CAAC,YAAY,CAAC;;;GAG1B,CAAC,CAAC,CAAC,EAAE,CAAC;IAEP,uCAAuC;IACvC,MAAM,SAAS,GAAG,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAmmB3B,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAiCV,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAkJzB,YAAY;GACf,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
function y(r, a) {
|
|
2
|
+
let e;
|
|
3
|
+
typeof r == "number" ? e = { rows: r, cols: a ?? 2 } : e = r;
|
|
4
|
+
const t = Math.max(1, Math.floor(e.rows)), n = Math.max(1, Math.floor(e.cols)), m = e.headers ?? Array.from({ length: n }, (o, s) => `Header ${s + 1}`), u = e.alignment ?? Array(n).fill("left"), d = m.slice(0, n).map((o) => o || " ").join(" | "), h = Array.from({ length: n }, (o, s) => {
|
|
5
|
+
const f = u[s] ?? "left";
|
|
6
|
+
return f === "center" ? ":---:" : f === "right" ? "---:" : "---";
|
|
7
|
+
}).join(" | "), c = Array.from(
|
|
8
|
+
{ length: t },
|
|
9
|
+
() => Array.from({ length: n }, () => " ").join(" | ")
|
|
10
|
+
).map((o) => `| ${o} |`).join(`
|
|
11
|
+
`);
|
|
12
|
+
let i = "";
|
|
13
|
+
const l = [];
|
|
14
|
+
return e.style && e.style !== "default" && l.push(`style=${e.style}`), e.borderStyle && e.borderStyle !== "solid" && l.push(`border=${e.borderStyle}`), l.length && (i = `<!-- mz-table: ${l.join(" ")} -->
|
|
15
|
+
`), `${i}| ${d} |
|
|
16
|
+
| ${h} |
|
|
17
|
+
${c}
|
|
18
|
+
`;
|
|
19
|
+
}
|
|
20
|
+
function b(r, a) {
|
|
21
|
+
if (r === null)
|
|
22
|
+
return null;
|
|
23
|
+
const e = r.trim();
|
|
24
|
+
if (!e)
|
|
25
|
+
return Math.max(1, a);
|
|
26
|
+
const t = Number.parseInt(e, 10);
|
|
27
|
+
return Number.isNaN(t) || t < 1 ? Math.max(1, a) : t;
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
y as b,
|
|
31
|
+
b as r
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=table-CJHCBhPo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-CJHCBhPo.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 const divider = Array.from({ length: safeCols }, (_, i) => {\n const align = alignment[i] ?? 'left';\n if (align === 'center') return ':---:';\n if (align === 'right') return '---:';\n return '---';\n }).join(' | ');\n\n const body = Array.from({ length: safeRows }, () =>\n Array.from({ length: safeCols }, () => ' ').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","divider","align","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,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C,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;"}
|
package/docs/index.md
CHANGED
|
@@ -31,13 +31,13 @@ features:
|
|
|
31
31
|
details: Formatting helpers live in src/actions and export with the library β no extra installs needed.
|
|
32
32
|
- icon: π§©
|
|
33
33
|
title: Plugin Library
|
|
34
|
-
details: Production-ready plugins for tables, Mermaid, syntax highlighting, media helpers, and more.
|
|
34
|
+
details: Production-ready plugins for tables (with alignment, style presets & borders), Mermaid, syntax highlighting, media helpers, and more.
|
|
35
35
|
- icon: ποΈ
|
|
36
36
|
title: Overlay Preview
|
|
37
37
|
details: Renders markdown directly over the textarea so alignment never drifts.
|
|
38
38
|
- icon: π¨
|
|
39
39
|
title: Themeable UI
|
|
40
|
-
details: Includes Solar (light) and Cave (dark) themes
|
|
40
|
+
details: Includes Solar (light) and Cave (dark) themes with full CSS variable customization.
|
|
41
41
|
- icon: π
|
|
42
42
|
title: Demo Bakeshop
|
|
43
43
|
details: A Vite + React playground that exercises every option and plugin in a live environment.
|
|
@@ -88,7 +88,6 @@ new Marzipan("#editor", {
|
|
|
88
88
|
| `tableGridPlugin` | Grid overlay for rapid column/row creation |
|
|
89
89
|
| `tableGeneratorPlugin` | Quick GFM table inserter with prompt-driven sizing |
|
|
90
90
|
| `tinyHighlightPlugin` | Zero-runtime syntax highlighting for fenced code blocks |
|
|
91
|
-
| `accentSwatchPlugin` | Synced accent palette picker |
|
|
92
91
|
| `imageManagerPlugin` | Dropzone and gallery UI for inserting images and managing uploads |
|
|
93
92
|
| `imagePickerPlugin` | Toolbar button for inserting images via URL or optional uploader callback |
|
|
94
93
|
| `mermaidPlugin` | Diagram rendering via ESM import |
|
package/docs/plugins.md
CHANGED
|
@@ -37,11 +37,7 @@ new Marzipan("#editor", {
|
|
|
37
37
|
import { Marzipan, plugins } from "@pinkpixel/marzipan";
|
|
38
38
|
|
|
39
39
|
new Marzipan("#editor", {
|
|
40
|
-
plugins: [
|
|
41
|
-
plugins.tablePlugin(),
|
|
42
|
-
plugins.mermaidPlugin(),
|
|
43
|
-
plugins.accentSwatchPlugin(),
|
|
44
|
-
],
|
|
40
|
+
plugins: [plugins.tablePlugin(), plugins.mermaidPlugin()],
|
|
45
41
|
});
|
|
46
42
|
```
|
|
47
43
|
|
|
@@ -51,18 +47,100 @@ Every factory returns an object that Marzipan consumes internally. You can mix a
|
|
|
51
47
|
|
|
52
48
|
| Plugin | Import Path | Description |
|
|
53
49
|
| ----------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------- |
|
|
54
|
-
| `accentSwatchPlugin` | `@pinkpixel/marzipan/plugins/accentSwatchPlugin` | Adds a palette picker for accent colours and syncs with the toolbar + stats bar. |
|
|
55
50
|
| `imageManagerPlugin` | `@pinkpixel/marzipan/plugins/imageManagerPlugin` | Dropzone and gallery UI for inserting images and managing uploads. |
|
|
56
51
|
| `imagePickerPlugin` | `@pinkpixel/marzipan/plugins/imagePickerPlugin` | Toolbar button for inserting images via URL or optional uploader callback. |
|
|
57
52
|
| `mermaidPlugin` | `@pinkpixel/marzipan/plugins/mermaidPlugin` | Lazy-loads Mermaid from npm/ESM and renders diagrams inline. |
|
|
58
53
|
| `mermaidExternalPlugin` | `@pinkpixel/marzipan/plugins/mermaidExternal` | Mermaid integration that targets a CDN script tagβperfect for sandboxed playgrounds. |
|
|
59
54
|
| `tablePlugin` | `@pinkpixel/marzipan/plugins/tablePlugin` | Toolbar-driven table generator with inline editing controls. |
|
|
60
|
-
| `tableGridPlugin` | `@pinkpixel/marzipan/plugins/tableGridPlugin` | Grid
|
|
55
|
+
| `tableGridPlugin` | `@pinkpixel/marzipan/plugins/tableGridPlugin` | Grid popover with alignment, style presets, and border options (exports `tableGridStyles`). |
|
|
61
56
|
| `tableGeneratorPlugin` | `@pinkpixel/marzipan/plugins/tableGenerator` | Quick GFM table inserter with prompt-driven sizing. |
|
|
62
57
|
| `tinyHighlightPlugin` | `@pinkpixel/marzipan/plugins/tinyHighlight` | Zero-runtime syntax highlighting for fenced code blocks (`tinyHighlightStyles` helper available). |
|
|
63
58
|
|
|
64
59
|
> π The plugin names map 1:1 to files in `src/plugins`. Inspect those files for advanced configuration options.
|
|
65
60
|
|
|
61
|
+
## Table Plugin Enhancements
|
|
62
|
+
|
|
63
|
+
The table plugins now support rich styling via GFM alignment markers and an HTML comment annotation system.
|
|
64
|
+
|
|
65
|
+
### Column Alignment
|
|
66
|
+
|
|
67
|
+
GFM column alignment is fully supported. Use `:---` (left), `:---:` (center), or `---:` (right) in the separator row:
|
|
68
|
+
|
|
69
|
+
```markdown
|
|
70
|
+
| Left | Center | Right |
|
|
71
|
+
| :--- | :----: | ----: |
|
|
72
|
+
| A | B | C |
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The `tableGridPlugin` popover includes alignment buttons (Left / Center / Right) that set the alignment for all columns.
|
|
76
|
+
|
|
77
|
+
### Style Presets
|
|
78
|
+
|
|
79
|
+
Four style presets are available via the `<!-- mz-table: style=<preset> -->` annotation:
|
|
80
|
+
|
|
81
|
+
| Preset | Description |
|
|
82
|
+
| --------- | ------------------------------------------------------ |
|
|
83
|
+
| `default` | Standard table styling β no extra classes. |
|
|
84
|
+
| `striped` | Alternating row backgrounds for readability. |
|
|
85
|
+
| `rainbow` | Cycles through six pastel colours per row. |
|
|
86
|
+
| `minimal` | Light borders with a clean, reduced-chrome appearance. |
|
|
87
|
+
|
|
88
|
+
### Border Styles
|
|
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. |
|
|
99
|
+
|
|
100
|
+
### Annotation Syntax
|
|
101
|
+
|
|
102
|
+
Place a hidden HTML comment immediately before the table to apply style and border options:
|
|
103
|
+
|
|
104
|
+
```markdown
|
|
105
|
+
<!-- mz-table: style=rainbow border=dashed -->
|
|
106
|
+
|
|
107
|
+
| Name | Score |
|
|
108
|
+
| ----- | ----- |
|
|
109
|
+
| Alice | 95 |
|
|
110
|
+
| Bob | 87 |
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The comment is invisible to standard markdown renderers and only parsed by Marzipan.
|
|
114
|
+
|
|
115
|
+
### `tableGridPlugin` Popover
|
|
116
|
+
|
|
117
|
+
The grid popover now includes an options panel below the size grid with:
|
|
118
|
+
|
|
119
|
+
- **Align** β Left / Center / Right toggle buttons.
|
|
120
|
+
- **Style** β Default / Striped / Rainbow / Minimal presets.
|
|
121
|
+
- **Border** β Solid / Dashed / Dotted / Double / None options.
|
|
122
|
+
|
|
123
|
+
Preferences are persisted to `localStorage` (key `marzipan.table.prefs`) so they survive page reloads.
|
|
124
|
+
|
|
125
|
+
### `buildTableMarkdown` Utility
|
|
126
|
+
|
|
127
|
+
The `buildTableMarkdown()` helper (exported from `@pinkpixel/marzipan/plugins/utils/table`) now accepts a `TableBuildOptions` object:
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
import { buildTableMarkdown } from "@pinkpixel/marzipan";
|
|
131
|
+
import type { TableBuildOptions } from "@pinkpixel/marzipan";
|
|
132
|
+
|
|
133
|
+
const md = buildTableMarkdown({
|
|
134
|
+
rows: 3,
|
|
135
|
+
cols: 4,
|
|
136
|
+
alignment: ["left", "center", "right", "left"],
|
|
137
|
+
style: "striped",
|
|
138
|
+
borderStyle: "dashed",
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
The original `(rows, cols)` signature remains supported for backward compatibility.
|
|
143
|
+
|
|
66
144
|
## Configuration tips
|
|
67
145
|
|
|
68
146
|
- **Tree shaking** β Import plugins individually; bundlers remove unused exports automatically.
|