Last active
July 2, 2020 19:24
-
-
Save phxtho/143ba0ba42fcd21429014d01da7ce512 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Added the following to https://github.com/houshuang/roam-export/blob/master/index.mjs | |
*/ | |
if (action === "--foam") { | |
let dir = 'export' | |
// Create the output dir if it doesn't exist | |
if (!fs.existsSync(dir)){ | |
fs.mkdirSync(dir); | |
} | |
pagesRaw.forEach((page) => { | |
// Output with page title for[[wiki-links]] graph view | |
let output = `# ${page.title} \n${processText(pages[page.title])}\n` | |
// Add backlinks if the page has them | |
if (linkedReferences[page.title]) | |
{ | |
output += ` | |
## Backlinks | |
${renderLinkedReferences(linkedReferences[page.title])}` | |
} | |
fs.writeFileSync(`${dir}/${page.title}.md`, output); | |
}) | |
console.log(`Exported ${pagesRaw.length} pages`); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment