mixu / markdown-styles

Markdown to static HTML generator and multiple CSS themes for Markdown
1.85k stars 251 forks source link

EJS is not working in Markdown files #46

Closed slavafomin closed 8 years ago

slavafomin commented 8 years ago

Hello!

Thank you for this great library!

However, I'm trying to use EJS in my Markdown files, but it's not working. The EJS code is not processed at all, it's just outputted to the resulted HTML file as is.

I've exported github layout and trying to add some partials to it in order to reuse them later, but I can't include partial to the Markdown file.

Here's my index.md:

{{> mypartial }}

It is rendered as <p>{{> mypartial }}</p> in HTML.

And the partial is located here: /src/layout/partials/mypartial.html. It's also not clear from the documentation what extension to use for the partial file: .html or .ejs. I've tried both with the same results.

Any suggestions will be highly appreciated. Thanks!

mixu commented 8 years ago

ahh, sorry, EJS is only currently supported as the templating language for layouts - it is not integrated with the markdown files themselves as the intended use-case is to convert markdown files to HTML with a template rather than to write templates in markdown itself. However, you could write a custom highlighter that evaluates code blocks that start with some special language name to evaluate EJS inside a markdown file, e.g. how I built spoiler text sections for my book https://github.com/mixu/cssbook/blob/master/layout/highlighters/spoiler.js