Skip to content

Commit

Permalink
changed toString method to toMarkdownString
Browse files Browse the repository at this point in the history
  • Loading branch information
souvikinator committed Dec 6, 2021
1 parent 8928e46 commit a43af3f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -181,7 +181,7 @@ console.log(result);

## API

### `toString(markdownObjects)`
### `toMarkdownString(markdownObjects)`

- takes output of `pageToMarkdown` or `blocksToMarkdown` as argument
- convert to markdown string.
Expand Down
4 changes: 2 additions & 2 deletions notion-to-md.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit a43af3f

Please sign in to comment.