@ai-matrx/records 0.94.0 → 0.95.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/CHANGELOG.md +13 -0
- package/dist/core/index.cjs +8 -0
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +7 -1
- package/dist/core/index.d.ts +7 -1
- package/dist/core/index.js +8 -0
- package/dist/core/index.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog — @ai-matrx/records
|
|
2
2
|
|
|
3
|
+
## 0.95.0 — a table exports as Markdown (lane FORMULA-2)
|
|
4
|
+
|
|
5
|
+
- **`exportMarkdown(fields, rows)`** (`@ai-matrx/records/core`): the same header and cells as `exportCsv` / `exportXlsx` (one cell
|
|
6
|
+
writer, `toAoa`), written as a pipe table. A `|` in a cell is escaped, a line break becomes `<br>`, no columns is no table.
|
|
7
|
+
- Tests: `a-table-exports-as-a-markdown-table.test.ts`.
|
|
8
|
+
- **Consumer action:** none. `@ai-matrx/records-ui` uses it for "Download Markdown" / "Copy as Markdown".
|
|
9
|
+
|
|
10
|
+
## 0.94.1
|
|
11
|
+
|
|
12
|
+
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
13
|
+
`git diff npm/records/v0.94.0..npm/records/v0.94.1 -- apps/shared/records`).
|
|
14
|
+
No source changes intended and no consumer action required.
|
|
15
|
+
|
|
3
16
|
## 0.94.0 — an archived row has a door back (lane F5)
|
|
4
17
|
|
|
5
18
|
From the live Applets audit (2026-10-09, R5): a reading-list Applet's archive confirm promised "you can restore it
|
package/dist/core/index.cjs
CHANGED
|
@@ -171,6 +171,7 @@ __export(core_exports, {
|
|
|
171
171
|
err: () => err,
|
|
172
172
|
exportCellText: () => exportCellText2,
|
|
173
173
|
exportCsv: () => exportCsv,
|
|
174
|
+
exportMarkdown: () => exportMarkdown,
|
|
174
175
|
exportPageXlsx: () => exportPageXlsx,
|
|
175
176
|
exportXlsx: () => exportXlsx,
|
|
176
177
|
fieldDeclarationFor: () => fieldDeclarationFor,
|
|
@@ -10697,6 +10698,13 @@ function headerFor(field) {
|
|
|
10697
10698
|
function exportCsv(fields, rows2) {
|
|
10698
10699
|
return (0, import_delimited.toDelimited)(toAoa(fields, rows2));
|
|
10699
10700
|
}
|
|
10701
|
+
function exportMarkdown(fields, rows2) {
|
|
10702
|
+
if (fields.length === 0) return "";
|
|
10703
|
+
const cell = (text2) => text2.replace(/\|/g, "\\|").replace(/\r?\n/g, "<br>").trim();
|
|
10704
|
+
const [head, ...body] = toAoa(fields, rows2);
|
|
10705
|
+
const line = (cells) => `| ${cells.map(cell).join(" | ")} |`;
|
|
10706
|
+
return [line(head ?? []), `| ${fields.map(() => "---").join(" | ")} |`, ...body.map(line)].join("\n") + "\n";
|
|
10707
|
+
}
|
|
10700
10708
|
function toAoa(fields, rows2) {
|
|
10701
10709
|
return [fields.map(headerFor), ...rows2.map((row) => fields.map((f) => exportCellText2(f, row[f.key])))];
|
|
10702
10710
|
}
|