Simple page cover doesn't really work.
mainrs opened this issue · comments
Hey!
I am currently looking for some tools to write down some notes and found this one. Looks super cool but I have some problems with it. I juse it the following way:
const Markdown = require('markdown-it');
const markdownInclude = require('markdown-it-include');
const brewdown = require('brewdown')
const glob = require('glob')
const fs = require('fs')
const path = require('path')
const args = process.argv.slice(2);
const folder = path.resolve(args[0]);
const md = new Markdown().use(brewdown, { style: "two-col", pageSize: "a4" });
glob(`${folder}/**/*.md`, {}, (err, files) => {
if (err) console.error(err);
files.forEach(file => {
const filename = path.basename(file, path.extname(file));
const folderPath = path.dirname(file);
const content = fs.readFileSync(file, 'utf-8');
const html = md.render(content);
const htmlFilePath = path.resolve(folderPath, `${filename}.html`);
fs.writeFileSync(htmlFilePath, html);
});
});
Basically it iterates over each .md
file and generates the html file alongside of the source used.
Now I tried it with the following content, expecting to get a cover page plus a simple text line on the next one but after opening the file in my browser I simply got the rendered text without any formatting or style.
::: cover
# Lost Mine of Phandelver
#### A smaller tl;dr version of the introduction story line
:::
\newpage
Test1
The reason your output is unstyled is because the Markdown-It library only produces a raw HTML fragment based on your markdown input.
Once you've converted your markdown to HTML, you then need to put it in a complete document with the styling of your choice. The brewdown library includes a stylesheet that matches the Player's Handbook from that you'll find in node_modules\brewdown\dist\styles\styles.css
.