diff --git a/README.md b/README.md index bc88310..7872328 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ const n2m = new notion2md({ notionClient: notion }); (async () => { const mdblocks = await n2m.pageToMarkdown("target_page_id"); - const mdString = n2m.toString(mdblocks); + const mdString = n2m.toMarkdownString(mdblocks); //writing to file fs.writeFile("test.md", mdString, (err) => { @@ -181,7 +181,7 @@ console.log(result); ## API -### `toString(markdownObjects)` +### `toMarkdownString(markdownObjects)` - takes output of `pageToMarkdown` or `blocksToMarkdown` as argument - convert to markdown string. diff --git a/notion-to-md.js b/notion-to-md.js index a43145a..2526dc3 100644 --- a/notion-to-md.js +++ b/notion-to-md.js @@ -10,7 +10,7 @@ class notion2md { this.notionClient = options.notionClient; } - toString(mdBlocks = [], nestingLevel = 0) { + toMarkdownString(mdBlocks = [], nestingLevel = 0) { let mdString = ""; mdBlocks.forEach((mdBlocks) => { if (mdBlocks.parent) { @@ -19,7 +19,7 @@ ${md.addTabSpace(mdBlocks.parent, nestingLevel)} `; } if (mdBlocks.children && mdBlocks.children.length > 0) { - mdString += this.toString(mdBlocks.children, nestingLevel + 1); + mdString += this.toMarkdownString(mdBlocks.children, nestingLevel + 1); } }); return mdString; diff --git a/package.json b/package.json index 71eeaca..33d15fb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "notion-to-md", - "version": "1.0.2", + "version": "1.0.3", "main": "notion-to-md.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1"