Skip to content

Commit c643f23

Browse files
replaced frontmatter with frontMatter in variables
1 parent 47ba279 commit c643f23

6 files changed

+21
-21
lines changed

src/config/default.docunotion.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const defaultConfig: IDocuNotionConfig = {
3636
standardInternalLinkConversion,
3737
standardExternalLinkConversion,
3838

39-
// Frontmatter transformers, add information to the page frontmatter
39+
// Frontmatter transformers, add information to the page frontMatter
4040
standardFrontmatterTransformer,
4141

4242
// Regexps plus javascript `import`s that operate on the Markdown output

src/plugins/FronmatterTransformer.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { GetPageResponse } from "@notionhq/client/build/src/api-endpoints";
22
import { NotionPage } from "../NotionPage";
33
import { standardFrontmatterTransformer } from "./FronmatterTransformer";
44

5-
let getFrontMatter = standardFrontmatterTransformer.frontmatterTransform
5+
let getFrontMatter = standardFrontmatterTransformer.frontMatterTransform
66
?.build as (page: NotionPage) => string;
77

88
const sampleMetadata: GetPageResponse = {
@@ -121,7 +121,7 @@ describe("getFrontMatter", () => {
121121
});
122122
});
123123

124-
it("should generate frontmatter with all available properties", () => {
124+
it("should generate frontMatter with all available properties", () => {
125125
const expectedFrontmatter = `title: FooBar\nsidebar_position: 1\nslug: /123\nkeywords: [Foo, Bar]\n`;
126126
(page.metadata as any).properties.Keywords.rich_text[0].plain_text =
127127
"Foo, Bar";
@@ -133,7 +133,7 @@ describe("getFrontMatter", () => {
133133

134134
// "title: Foo-Barsidebar_position: 1slug: keywords: [Foo, Bar]"
135135
// "title: FooBar\nsidebar_position: 1\nslug: /123\n"
136-
it("should generate frontmatter with no keywords", () => {
136+
it("should generate frontMatter with no keywords", () => {
137137
const expectedFrontmatter = `title: FooBar\nsidebar_position: 1\nslug: /123\n`;
138138
(page.metadata as any).properties.Keywords = undefined;
139139

src/plugins/FronmatterTransformer.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ import { IPlugin } from "./pluginTypes";
22
import { NotionPage } from "../NotionPage";
33

44
function getFrontmatter(page: NotionPage): string {
5-
let frontmatter = "";
6-
frontmatter += `title: ${page.nameOrTitle.replaceAll(":", "-")}\n`; // I have not found a way to escape colons
7-
frontmatter += `sidebar_position: ${page.order}\n`;
8-
frontmatter += `slug: ${page.slug ?? ""}\n`;
9-
if (page.keywords) frontmatter += `keywords: [${page.keywords}]\n`;
5+
let frontMatter = "";
6+
frontMatter += `title: ${page.nameOrTitle.replaceAll(":", "-")}\n`; // I have not found a way to escape colons
7+
frontMatter += `sidebar_position: ${page.order}\n`;
8+
frontMatter += `slug: ${page.slug ?? ""}\n`;
9+
if (page.keywords) frontMatter += `keywords: [${page.keywords}]\n`;
1010

11-
return frontmatter;
11+
return frontMatter;
1212
}
1313

1414
export const standardFrontmatterTransformer: IPlugin = {
1515
name: "standardFrontmatterTransformer",
1616

17-
frontmatterTransform: {
17+
frontMatterTransform: {
1818
build: getFrontmatter,
1919
},
2020
};

src/plugins/pluginTestRun.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export async function blocksToMarkdown(
9292
return r;
9393
}
9494

95-
// This is used for things like testing links to other pages and frontmatter creation,
95+
// This is used for things like testing links to other pages and frontMatter creation,
9696
// when just testing what happens to individual blocks is not enough.
9797
// after getting this, you can make changes to it, then pass it to blocksToMarkdown
9898
export function makeSamplePageObject(options: {

src/plugins/pluginTypes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ export type IPlugin = {
3535
// simple regex replacements on the markdown output
3636
regexMarkdownModifications?: IRegexMarkdownModification[];
3737

38-
// operations on pages to define the markdown's frontmatter
39-
frontmatterTransform?: {
38+
// operations on pages to define the markdown's frontMatter
39+
frontMatterTransform?: {
4040
build: (page: NotionPage) => string;
4141
};
4242

src/transform.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ export async function getMarkdownForPage(
3030
logDebugFn("markdown from page", () => JSON.stringify(blocks, null, 2));
3131

3232
const body = await getMarkdownFromNotionBlocks(context, config, blocks);
33-
const frontmatter = getMarkdownFrontMatter(config, page);
34-
return `${frontmatter}\n${body}`;
33+
const frontMatter = getMarkdownFrontMatter(config, page);
34+
return `${frontMatter}\n${body}`;
3535
}
3636

3737
// this is split off from getMarkdownForPage so that unit tests can provide the block contents
@@ -256,13 +256,13 @@ function getMarkdownFrontMatter(
256256
config: IDocuNotionConfig,
257257
page: NotionPage
258258
): string {
259-
let frontmatter = "---\n";
259+
let frontMatter = "---\n";
260260
config.plugins.forEach(plugin => {
261-
if (plugin.frontmatterTransform) {
261+
if (plugin.frontMatterTransform) {
262262
logDebug("transforming page with plugin", plugin.name);
263-
frontmatter += plugin.frontmatterTransform?.build(page);
263+
frontMatter += plugin.frontMatterTransform?.build(page);
264264
}
265265
});
266-
frontmatter += "---\n";
267-
return frontmatter;
266+
frontMatter += "---\n";
267+
return frontMatter;
268268
}

0 commit comments

Comments
 (0)