-
-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nunjucks in md files #11
Comments
At this moment, there's no way to mix nunjucks and markdown. Maybe I could create a new file extension, let's say Anyway, one way to do this now is by changing the extensions of these files. For example, instead index.njk: ---
title: Hello world
layout: main.njk
---
# {{ title }} main.njk: <html>
<body>
{{ content | md | safe }}
</body>
</html> |
yes, that works, thanks. Rather than creating a new extension, I'd suggest making the whole process more configurable. Static sites can be built from any number of sources, for example, from cloud-based databases. They aren't useful for data that changes frequently, but they're perfect for publishing other data at little or no cost. Templates can be used in any type of file, for example, in js or css. So, it would be good to have the option to define in the config file which part of the build is run in which order, for example, run this script to fetch data from database, then run Nunjucks on the md files in dirA, then convert md files in dirB to html, and so on. There's currently the ability to run scripts from the command line, but it would also be useful to be able to just run Nunjucks or md conversion on a directory or even a single file, without having the recreate the whole site every time. No hurry, of course, I can use what's there atm. Just something to think about for future development. 😄 |
1tty has a nice option Having something like that, you could configure how a specific file is rendered or, if you save the config value it in a |
yes, having the ability to specify md only or md+template language both globally and at a directory level would solve this particular problem. I found a further problem here yesterday: I set up a couple of njk files as you suggested, which worked, but I then added some md files in the same directory, and it stopped working. I had to put the md files in a separate subdir for it to work again. I can put other suggested improvements to the flow in separate issues. |
Ok, I've added support for the |
yeah, that's much more flexible, thanks. Are you planning on releasing 0.10 soon? If so, I'll wait. Otherwise, I could download the current master and try with that. |
Probably today |
v0.10.0 released. |
I can't get this to work. To simplify, if
and I'm ending up with lines of:
where title and no are the correct values for each line. So, Nunjucks is substituting the data correctly, but the result is not being converted from md into html. Am I missing something? |
I just tested your example and it works fine to me: Maybe it is something related with cache (again). Try to clean deno cache and reinstall lume again. |
yes, now works; it was indeed the cache. Looks like cache reload does not work properly. |
I'm converting an old Jekyll site to Lume, and one issue I'm running into is that the md files contain
{{ ... }}
, but it looks like these are not being parsed. https://lumeland.github.io/plugins/nunjucks/ says "just place the .njk or .html file outside the _includes folder", but in my case these are .md files, not .html. I tried a simple test with a layout which includes an md file with{{ content | safe }}
: if I put{{ myData }}
in the layout file, it is parsed correctly, but if I put it in the md file, it is included unparsed in the output html. Is this intentional, or a bug of some sort? Or do I have to define something else to get the Nunjucks variables in md files parsed?The text was updated successfully, but these errors were encountered: