Skip to content
This repository was archived by the owner on Mar 9, 2025. It is now read-only.

Commit c31d679

Browse files
authored
Merge pull request #930 from trey-wallis/dev
8.15.12
2 parents 5df0b6f + a1f8aff commit c31d679

File tree

6 files changed

+18
-9
lines changed

6 files changed

+18
-9
lines changed

bun.lockb

0 Bytes
Binary file not shown.

manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
"fundingUrl": {
1010
"Buymeacoffee": "https://www.buymeacoffee.com/treywallis"
1111
},
12-
"version": "8.15.11"
12+
"version": "8.15.12"
1313
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "obsidian-dataloom",
3-
"version": "8.15.11",
3+
"version": "8.15.12",
44
"description": "Weave together data from diverse sources into different views. Inspired by Excel Spreadsheets and Notion.so.",
55
"main": "main.js",
66
"scripts": {

src/shared/export/export-to-markdown.tsx

+11-6
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,23 @@ import { LoomState } from "../loom-state/types/loom-state";
22
import { markdownTable } from "markdown-table";
33
import { loomStateToArray } from "./loom-state-to-array";
44
import { App } from "obsidian";
5-
import { escapePipeCharacters } from "./export-utils";
5+
import {
6+
escapePipeCharacters,
7+
replaceNewLinesWithBreaks,
8+
} from "./export-utils";
69

710
export const exportToMarkdown = (
811
app: App,
912
loomState: LoomState,
1013
shouldRemoveMarkdown: boolean
1114
): string => {
12-
const arr = loomStateToArray(app, loomState, shouldRemoveMarkdown);
15+
let arr = loomStateToArray(app, loomState, shouldRemoveMarkdown);
16+
17+
//Markdown table cells can't contain new lines, so we replace them with <br> tags
18+
arr = arr.map((row) => row.map((cell) => replaceNewLinesWithBreaks(cell)));
19+
1320
//Markdown table cells can't contain pipe characters, so we escape them
1421
//Obsidian will render the escaped pipe characters as normal pipe characters
15-
const escapedArr = arr.map((row) =>
16-
row.map((cell) => escapePipeCharacters(cell))
17-
);
18-
return markdownTable(escapedArr);
22+
arr = arr.map((row) => row.map((cell) => escapePipeCharacters(cell)));
23+
return markdownTable(arr);
1924
};

src/shared/export/export-utils.ts

+3
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
export const escapePipeCharacters = (value: string) =>
22
value.replace(/\|/g, "\\|");
3+
4+
export const replaceNewLinesWithBreaks = (value: string) =>
5+
value.replace(/\n/g, "<br>");

versions.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -160,5 +160,6 @@
160160
"8.15.8": "1.4.0",
161161
"8.15.9": "1.4.0",
162162
"8.15.10": "1.4.0",
163-
"8.15.11": "1.4.0"
163+
"8.15.11": "1.4.0",
164+
"8.15.12": "1.4.0"
164165
}

0 commit comments

Comments
 (0)