Skip to content

Commit b8e21e7

Browse files
feat: add a db config flag to suppress rendering of markdown tables
1 parent 32f94ec commit b8e21e7

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

src/BlockRenderer.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ export class BlockRenderer {
115115
const db = await this.deferredRenderer.renderDatabasePages(block.id);
116116
const msg = `<!-- included database ${block.id} -->\n`;
117117

118+
if (db.config.skipMarkdownTable) {
119+
return msg;
120+
}
121+
118122
// todo: make this nicer, e.g. render multi tables
119123
return msg + this.renderTables(db);
120124

src/PageRenderer.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ export class PageRenderer {
3535
if (!category) {
3636
this.throwMissingRequiredProperty("category", page);
3737
}
38-
39-
debug(props);
40-
38+
4139
const nameSlug = slugify(name);
4240
const categorySlug = slugify(category);
4341

src/PropertiesParser.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ export class PropertiesParser {
4242
return value.multi_select.map((x) => x.name);
4343
case "date":
4444
return value.date;
45+
case "relation":
46+
return value.relation.map((x) => x.id);
4547
case "formula":
4648
case "rollup":
47-
case "relation":
4849
case "people":
4950
case "files":
5051
case "checkbox":

src/SyncConfig.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ export interface SyncConfig {
44
/**
55
* Id of the Notion database containing the CMS content.
66
* Traversing the block graph starts here.
7-
*
7+
*
88
* By convention this database must have the following properties
9-
*
9+
*
1010
* - Name: page name
1111
* - Category: page category
1212
* - sort: number to control sorting of pages in sidebar
@@ -15,14 +15,14 @@ export interface SyncConfig {
1515

1616
/**
1717
* The output directory where the sync will place pages.
18-
*
18+
*
1919
* Example: "docs/"
2020
*/
2121
outDir: string;
2222

2323
/**
2424
* The path where the sync will store an index of rendered pages and their properties.
25-
* The index is
25+
* The index is
2626
*/
2727
indexPath: string;
2828

@@ -36,7 +36,7 @@ export interface SyncConfig {
3636
export interface DatabaseConfig {
3737
/**
3838
* The output directory where the sync will place pages of this database.
39-
*
39+
*
4040
* Example: docs/mydb"
4141
*/
4242
outDir: string;
@@ -46,18 +46,19 @@ export interface DatabaseConfig {
4646
*/
4747
sorts?: Sort[];
4848

49+
skipMarkdownTable?: boolean;
50+
4951
/**
5052
* Configuration options for Notion API page properties
5153
*/
5254
properties: {
5355
/**
54-
* The Notion API page property that provides the value to use for the markdown page category.
55-
* This will be prefixed by DatabaseConfig.pageCategoryValuePrefix
56-
*
56+
* The Notion API page property that provides an optional sub-category value to use for the markdown page category.
57+
*
5758
* Example: "Cluster"
5859
*/
5960
category: string;
60-
61+
6162
/**
6263
* A whitelist of Notion API page property names to include in the markdown page properties.
6364
* Use this to select properties for export and control their ordering in rendered tables.

0 commit comments

Comments
 (0)