Scripts for:
- markdown -> html
- html -> pdf
- html -> png
The scratch-LN library is included.
(Scripts run on windows 10)
- pandoc
- recent version of node (I used v8.11.1)
- puppeteer, (
npm install puppeteer -g) - I used cygwin to run scripts
You first have to generate the html with pandoc, next you can use the puppeteer script to make a pdf. Some script are provided but might need some adjustments to work for you.
The file create-web.sh generates a html file using pandoc. Give as argument the 'name' of one or more files in the markdown-directory, this is without extension, it will output a html file in the web-directory. The html file contains the header defined in head.html. This header contains the reference to scratch-LN. If the option -a is provided all files in the markdown-directory will be generated.
verify in the create-web.sh:
- how you run pandoc
This script can be runned as
./create-web.sh -a= all files in theweb-directory./create-web.sh test= the file named test in theweb-directory./create-web.sh test test2= the files named test and test2 in theweb-directory
The file makePDF.js generates the pdf using puppeteer. No arguments generates all files in the web-directory, the name(s) (same as above without extension) of selected files is also possible.
verify in the makePDF.js:
- module.paths
- directory const
This script can be runned as
node makePDF.js= all files in theweb-directorynode makePDF.js test= the file named test in theweb-directorynode makePDF.js test test2= the files named test and test2 in theweb-directory
Similar to above (makePDF). Some useful information:
- Choose the DOM element and the margin
screenshotDOMElement('table', 16); - Make the viewport large enough and set the deviceScaleFactor higher for better quality.
await page.setViewport({
width: 960,
height: 1080,
deviceScaleFactor: 1//5
});- Something weird... The *2 fixed some problem but I don't think it makes sense.
return await page.screenshot({
path: 'img/'+name+'.png',
clip: {
x: rect.left*2 - padding,
y: rect.top*2 - padding,
width: rect.width + padding,
height: rect.height + padding
}
});- Ellen Vanhove - [email protected]