Skip to content

Commit 32f94ec

Browse files
fix: render markdown tables with other property content than strings
1 parent 9fcd2bc commit 32f94ec

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/BlockRenderer.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export class BlockRenderer {
140140
const props = db.pages[0].properties;
141141

142142
const table: any[][] = [];
143-
143+
144144
const headers = Array.from(props.keys.keys());
145145
table[0] = headers;
146146

@@ -203,7 +203,11 @@ export class BlockRenderer {
203203
}
204204
}
205205

206-
function escapeTableCell(content: string): string {
206+
function escapeTableCell(content: string | number | any): string {
207207
// markdown table cells do not support newlines, however we can insert <br> elements instead
208-
return content.replace(/\n/g, "<br>");
208+
if (typeof content === "string") {
209+
return content.replace(/\n/g, "<br>");
210+
}
211+
212+
return content.toString();
209213
}

0 commit comments

Comments
 (0)