// 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 ☀
//
// |
//
${tocHtml_}
`;
return tocHtml_;
}
function renderMdToHtml(md, targetPath, templateParams) {
// Remove the header because it's going to be added back as HTML
md = md.replace(/# Joplin\n/, '');
templateParams.baseUrl = 'https://joplinapp.org';
templateParams.imageBaseUrl = `${templateParams.baseUrl}/images`;
templateParams.tocHtml = tocHtml();
const title = [];
if (!templateParams.title) {
title.push('Joplin - an open source note taking and to-do application with synchronisation capabilities');
} else {
title.push(templateParams.title);
title.push('Joplin');
}
md = replaceGitHubByJoplinAppLinks(md);
templateParams.pageTitle = title.join(' | ');
const html = markdownToHtml(md, templateParams);
const folderPath = dirname(targetPath);
fs.mkdirpSync(folderPath);
fs.writeFileSync(targetPath, html);
}
function renderFileToHtml(sourcePath, targetPath, templateParams) {
const md = fs.readFileSync(sourcePath, 'utf8');
return renderMdToHtml(md, targetPath, templateParams);
}
function makeHomePageMd() {
let md = fs.readFileSync(`${rootDir}/README.md`, 'utf8');
md = md.replace(tocRegex_, '');
// HACK: GitHub needs the \| or the inline code won't be displayed correctly inside the table,
// while MarkdownIt doesn't and will in fact display the \. So we remove it here.
md = md.replace(/\\\| bash/g, '| bash');
return md;
}
async function main() {
tocMd();
renderMdToHtml(makeHomePageMd(), `${rootDir}/docs/index.html`, { sourceMarkdownFile: 'README.md' });
const sources = [
['readme/changelog.md', 'docs/changelog/index.html', { title: 'Changelog (Desktop App)' }],
['readme/changelog_cli.md', 'docs/changelog_cli/index.html', { title: 'Changelog (CLI App)' }],
['readme/clipper.md', 'docs/clipper/index.html', { title: 'Web Clipper' }],
['readme/debugging.md', 'docs/debugging/index.html', { title: 'Debugging' }],
['readme/desktop.md', 'docs/desktop/index.html', { title: 'Desktop Application' }],
['readme/donate.md', 'docs/donate/index.html', { title: 'Donate' }],
['readme/e2ee.md', 'docs/e2ee/index.html', { title: 'End-To-End Encryption' }],
['readme/faq.md', 'docs/faq/index.html', { title: 'FAQ' }],
['readme/mobile.md', 'docs/mobile/index.html', { title: 'Mobile Application' }],
['readme/spec.md', 'docs/spec/index.html', { title: 'Specifications' }],
['readme/stats.md', 'docs/stats/index.html', { title: 'Statistics' }],
['readme/terminal.md', 'docs/terminal/index.html', { title: 'Terminal Application' }],
['readme/api.md', 'docs/api/index.html', { title: 'REST API' }],
['readme/prereleases.md', 'docs/prereleases/index.html', { title: 'Pre-releases' }],
['readme/markdown.md', 'docs/markdown/index.html', { title: 'Markdown Guide' }],
['readme/nextcloud_app.md', 'docs/nextcloud_app/index.html', { title: 'Joplin Web API for Nextcloud' }],
['readme/gsoc2020/index.md', 'docs/gsoc2020/index.html', { title: 'Google Summer of Code' }],
['readme/gsoc2020/ideas.md', 'docs/gsoc2020/ideas/index.html', { title: 'GSoC: Project Ideas' }],
['readme/gsod2020/index.md', 'docs/gsod2020/index.html', { title: 'Google Season of Docs' }],
['readme/gsod2020/ideas.md', 'docs/gsod2020/ideas/index.html', { title: 'Google Season of Docs: Project Ideas' }],
];
const path = require('path');
for (const source of sources) {
source[2].sourceMarkdownFile = source[0];
source[2].sourceMarkdownName = path.basename(source[0], path.extname(source[0]));
renderFileToHtml(`${rootDir}/${source[0]}`, `${rootDir}/${source[1]}`, source[2]);
}
}
main().catch((error) => {
console.error(error);
});