-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Make Nunjucks in posts optional #1510
Comments
Nunjuks needs to ignore markdown codeblock else it is impossible to add some templating code in a post. Example of python with flask: https://ghostbin.com/paste/32qdz Resulting in:
At least it should be possible to write Note that the @leesei said it helps, but I can confirm that |
Important note
Working workaround
I didn't tried but PS : this is a lot of additional work to move all markdown code block in back-ticks to a separate file and include this. Plus, instead of having a 100% pure markdown file + front matter (easily removable) you get a mix between markdown and hexo tag plugin tags so your file is no more easily exportable or usable for another tool. |
Currently, only the renderer could specify if Nunjucks enable or not. #2593 |
I can't use that, this is all enabled or all disabled. |
@noraj1337 Another work around is using the HTML encoding, like |
@NoahDragon Can't use that neither because PS : |
This is very confusing behaviour; it would be nice if nunjucks could be outright disabled for markdown files. Another example case that fails: # Some Heading {#custom-id}
Some text...
# Another Heading {#another-id}
Some more text... also, see [here](#custom-id). |
It would make more sense to me; if nunjucks processing was desirable on a file then it would just have a filename like
The default output of nunjucks would probably be ".html" to make that the default output of nunjucks unless something else is specified. For example, a template file with the name "my-page.nunjucks" would be processed with nunjucks processor resulting in a "my-page.html" whilst a "my-page.json.nunjucks" would be processed with nunjucks processor resulting in a "my-page.json". The advantage with this approach is that use of template engine is explicitly defined on the files that were designed to actually use them. And vanilla |
@kruncher For me it make more sense to configure it in front matters as it is for all parameters that have to be per file config. If the source of your website is under a DVCS (example: git), a modification of front matters (nunjucks processing to nunjucks disable for example) will be tracked. If using a file extension For me this is a very bad idea. |
If you want to put nunjucks syntax in a markdown file.. then it's no longer a markdown file. So it's a huge mistake to confuse the format in my opinion.
In my opinion not; since it should never have been a markdown file if it contains nunjucks syntax. |
And |
I ran into these issue too, writing tools: hexo-renderer-markdown-it |
It causes weird and impossible to understand errors with Markdown files and have no obvious benefits.
Using
{% raw %}
doesn’t help because it breaks other things.Related issues: #538, #569, #587, #603, #623, #971, #1079, #1109, #1369, #1372, #1404 and many more.
The text was updated successfully, but these errors were encountered: