construct notes build system

This commit is contained in:
yenru0 committed 2025-10-22 03:18:51 +09:00
1 parent 6f41ae9730
commit bf60eeff7e
5 files changed
+6997 -1

No files matched your search

+2
View File
@@ -4,3 +4,5 @@
*.out
notes/*.o
notes/*.s
node_modules/
+6 -1
View File
@@ -1,4 +1,9 @@
all:
all: clean build
clean:
rm -f ./notes/*.out
rm -f ./notes/*.o
rm -f ./notes/*.s
build:
node build.js
+43
View File
@@ -0,0 +1,43 @@
const { Notebook } = require("crossnote")
const path = require('path')
const fs = require('fs')
async function main() {
const notebook = await Notebook.init(
{
notebookPath: path.resolve(''),
config: {
previewTheme: 'github-light.css',
mathRenderingOption: 'KaTeX',
codeBlockTheme: 'github.css',
printBackground: true,
enableScriptExecution: true,
chromePath: '/usr/bin/google-chrome-stable',
},
}
);
const files = fs.readdirSync(path.resolve('notes')).filter(file => {
return path.extname(file).toLowerCase() == '.md';
});
files.forEach(async (file) => {
const fileBase = "notes/" +path.basename(file);
const fileName = path.basename(file, ".md")
console.log("found " + fileBase);
const engine = notebook.getNoteMarkdownEngine(fileBase);
await engine.chromeExport({ runAllCodeChunks: true });
const old = path.resolve('notes', fileName + ".pdf");
const dest = path.resolve('out', 'notes', fileName + ".pdf");
fs.rename(old, dest, (err) => {
if (err) throw err;
console.log(fileName + ".pdf" + " moved to out completed");
});;
});
}
main();
+6941
View File
File diff suppressed because it is too large. Load diff
+5
View File
@@ -0,0 +1,5 @@
{
"dependencies": {
"crossnote": "^0.9.15"
}
}