tom-wolfe / brewdown

A markdown parser and stylesheet specifically for D&D homebrew
MIT License
66 stars 11 forks source link

No css in rendered html #12

Open Demonsthere opened 5 years ago

Demonsthere commented 5 years ago

Hi there, I wanted to try this, as I usually use markdown for my dnd game notes and content, but I couldn't manage to get the CSS working.

I have a simple script that i run on my md files:

const Markdown = require('markdown-it');
const brewdown = require('brewdown');
var fs = require('fs');

const contentFile = "test.md";
const md = new Markdown().use(brewdown, {style: "two-col", pageSize: "letter"});
var content = fs.readFileSync(contentFile, "utf-8");
const html = md.render(content);
// console.log(html)
fs.writeFile('content.html', html, (err) => { 
    if (err) throw err;
})

But the result of an example from Your projects looks like this:

Zrzut ekranu 2019-09-7 o 13 58 12

Could you point me in the right direction here? Cheers

VictorK1902 commented 4 years ago

So the way I did it is after running

npm install brewdown --save

brewdown should be installed to

node_modules\brewdown

There you will find

dist\js\brewdown.js
dist\styles\styles.css
dist\styles\images\...

You need to reference this styles.css in your output content.html. Just open the html file in a text editor and add a reference to the top of it. For example:

<link rel="stylesheet" href="dist/styles/styles.css">

Then save and double click on it. If everything is done right, it should render your content using the css correctly. It's my first time messing with this too. Hopefully I'm not missing anything here.


Unfortunately this doesn't seem to translate well to pdf-printing

c1 c2