-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
{% %} should not be rendered in a post #3346
Comments
I suppose your not suppose to have ejs code inside your .md file , are to trying to showcase a code snippet ? |
Thanks for your reply, now i try to explain my issue in English.
|
but when i write the code like this |
Yup, I know. I reproduce it v3.8.0 |
Thanks, I got it. hope it will be fixed on next release version. |
我今天也遇到了这个问题,我对问题的理解以及解决方法如下: 首先,{% test %} 是一个未知的标签,Hexo 是不会支持的,支持的标签可以参考这个官方文档:标签插件(Tag Plugins) 另外,即使这个标签是 Hexo 支持的,那么 {% xxx %} 和 {% endxxx %} 需要配合使用,一个标志开始,一个标志结束,不能只用一个。 只使用一个会报错 另外,如果文章中出现单独的 {{ 或者 }} 也会报错,原因也是因为 {{ 和 }} 被 Hexo 当作标签的标志来处理了。 更多的内容,可以参考我博客的这篇文章:Hexo 的 Template render error 错误 |
The issue is related to The post rendering process could be described as follows: #4161 (comment) |
Could be fixed by #4171. |
the example given in #3259,
will be rendered to, (which is not desired) <code>2</code> A workaround is to use
that will be rendered to the expected result, <code>{{ 1+1 }}</code> but if a post has many template examples, that's a lot of typing. However, triple backtick does work as expected though,
which will rendered to code highlighted "{{ 1+1 }}". TL;DR nunjucks template is not rendered in triple backtick (as expected), but rendered in single backtick (not expected). @SukkaW @stevenjoezhang @seaoak I understand #4171 has already include many fixes, but I wonder if it can help #3259. |
{% %}
语法会报错,提示“Template render error: (unknown path) ”
Environment Info
Node version(
node -v
):Your site
_config.yml
(Optional):Your theme
_config.yml
(Optional):Hexo and Plugin version(
npm ls --depth 0
):For BUG
比如新建一个名为“test.md”的文档,在里面包含以下这句话,
测试测试测试
{% test %}
测试测试在使用hexo g 命令时就会报错,提示Template render error: (unknown path)
而如果把上面的文字改成
测试测试测试
测试
这样使用hexo g 命令就会通过。
而在markdown 编辑器中 ,测试测试测试
{% test %}
测试测试 这样的写法是支持的,预览也不会出任何问题。For question
For feature request
The text was updated successfully, but these errors were encountered: