const fs = require('fs-extra'); const dirname = require('path').dirname; const marked = require('marked'); const Mustache = require('mustache'); const headerHtml = ` Joplin - an open source note taking and to-do application with synchronisation capabilities

oplin

An open source note taking and to-do application with synchronisation capabilities.

`; const footerHtml = ` `; // const screenshotHtml = ` // // // // // // // // // //
// Mobile // // Command line //
// // //
// joplin:/My notebook$ ls -n 12
// [ ] 8am conference call ☎
// [ ] Make vet appointment
// [ ] Go pick up parcel
// [ ] Pay flat rent 💸
// [X] Book ferry 🚢
// [X] Deploy Joplin app
//     Open source stuff
//     Swimming pool time table 🏊
//     Grocery shopping list 📝
//     Work itinerary
//     Tuesday random note
//     Vacation plans ☀
// 			
//
// `; const scriptHtml = ` `; const rootDir = dirname(__dirname); function markdownToHtml(md) { const renderer = new marked.Renderer(); // Remove the header because it's going to be added back as HTML md = md.replace(/# Joplin/, ''); let output = marked(md, { gfm: true, break: true, renderer: renderer, }); //output = output.replace(//, screenshotHtml); return headerHtml + output + scriptHtml + footerHtml; } function renderFileToHtml(sourcePath, targetPath, params) { const md = fs.readFileSync(sourcePath, 'utf8'); params.baseUrl = 'https://joplin.cozic.net'; params.imageBaseUrl = params.baseUrl + '/images'; const html = Mustache.render(markdownToHtml(md), params); fs.writeFileSync(targetPath, html); } async function main() { renderFileToHtml(rootDir + '/README.md', rootDir + '/docs/index.html', { selectedHome: 'selected', }); renderFileToHtml(rootDir + '/readme/terminal.md', rootDir + '/docs/terminal/index.html', { selectedTerminal: 'selected', }); renderFileToHtml(rootDir + '/readme/desktop.md', rootDir + '/docs/desktop/index.html', { selectedDesktop: 'selected', }); renderFileToHtml(rootDir + '/readme/e2ee.md', rootDir + '/docs/e2ee/index.html', {}); renderFileToHtml(rootDir + '/readme/spec.md', rootDir + '/docs/spec/index.html', {}); renderFileToHtml(rootDir + '/readme/stats.md', rootDir + '/docs/stats/index.html', {}); renderFileToHtml(rootDir + '/readme/changelog.md', rootDir + '/docs/changelog/index.html', {}); renderFileToHtml(rootDir + '/readme/donate.md', rootDir + '/docs/donate/index.html', {}); } main().catch((error) => { console.error(error); });