hexo: 3.2.2
hexo-cli: 1.1.0
os: Windows_NT 10.0.16299 win32 x64
http_parser: 2.8.0
node: 8.11.1
v8: 6.2.414.50
uv: 1.19.1
zlib: 1.2.11
ares: 1.10.1-DEV
modules: 57
nghttp2: 1.25.0
openssl: 1.0.2o
icu: 60.1
unicode: 10.0
cldr: 32.0
tz: 2017c
If I insert {#index} into my .md file, then generation process will fail!
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Template render error: (unknown path)
Error: expected end of comment, got end of file
at Object.exports.prettifyError (D:\Blog\RainVector.github.io\node_modules\nunjucks\src\lib.js:34:15)
at new_cls.render (D:\Blog\RainVector.github.io\node_modules\nunjucks\src\environment.js:468:27)
at new_cls.renderString (D:\Blog\RainVector.github.io\node_modules\nunjucks\src\environment.js:326:21)
at D:\Blog\RainVector.github.io\node_modules\hexo\lib\extend\tag.js:66:9
at Promise._execute (D:\Blog\RainVector.github.io\node_modules\bluebird\js\release\debuggability.js:272:9)
at Promise._resolveFromExecutor (D:\Blog\RainVector.github.io\node_modules\bluebird\js\release\promise.js:475:18)
at new Promise (D:\Blog\RainVector.github.io\node_modules\bluebird\js\release\promise.js:77:14) at Tag.render (D:\Blog\RainVector.github.io\node_modules\hexo\lib\extend\tag.js:64:10)
at Object.tagFilter [as onRenderEnd] (D:\Blog\RainVector.github.io\node_modules\hexo\lib\hexo\post.js:253:16)
at D:\Blog\RainVector.github.io\node_modules\hexo\lib\hexo\render.js:65:19
at tryCatcher (D:\Blog\RainVector.github.io\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (D:\Blog\RainVector.github.io\node_modules\bluebird\js\release\promise.js:504:31)
at Promise._settlePromise (D:\Blog\RainVector.github.io\node_modules\bluebird\js\release\promise.js:561:18)
at Promise._settlePromise0 (D:\Blog\RainVector.github.io\node_modules\bluebird\js\release\promise.js:606:10)
at Promise._settlePromises (D:\Blog\RainVector.github.io\node_modules\bluebird\js\release\promise.js:685:18)
at Async._drainQueue (D:\Blog\RainVector.github.io\node_modules\bluebird\js\release\async.js:138:16)
at Async._drainQueues (D:\Blog\RainVector.github.io\node_modules\bluebird\js\release\async.js:148:10)
at Immediate.Async.drainQueues [as _onImmediate] (D:\Blog\RainVector.github.io\node_modules\bluebird\js\release\async.js:17:14)
at runCallback (timers.js:794:20)
at tryOnImmediate (timers.js:752:5)
at processImmediate [as _immediateCallback] (timers.js:729:5)
What is {#index} code?
Does this file mentioned in the error give you clues? D:\Blog\RainVector.github.io\node_modules\nunjucks\src\lib.js:34:15
@tcrowe
{#index} is just a example. If you write {#anything}, you can also get the errros.
Yes, this file is mentioned in the error.
I've found how to solve this problem.
I have to insert a space between { and #.
{ #anything} and { #anything } is right.
This issue has been automatically marked as stale because lack of recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I landed on this page through Google. Although the issue is closed, I want to share something in case of someone else landed on this page.
What happened is that your {# begins a Nunjucks comment. and the error indicates that Nunjucks is looking for a closing #}.
Nunjucks is used by Hexo to render tags. It is IMHO a stupid design since it mixes two languages together (and Hexo tries to parse Nunjucks with regular expressions). This is extremely annoying especially when one uses {} in maths environment or in code blocks.
So in your case, adding a space after the bracket makes it no longer a piece of Nunjucks code. If one does not use Nunjucks tags at all, one could turn off Nunjucks rendering. how this is done varies with which renderer one uses, but in general the line module.exports.disableNunjucks = true; needs to be somewhere in the renderer plugin.
@RichardYan314 Another solution is using {{ '{#' }} to replace {#. {# ... #} is used as comment in Hexo.
Most helpful comment
I landed on this page through Google. Although the issue is closed, I want to share something in case of someone else landed on this page.
What happened is that your
{#begins a Nunjucks comment. and the error indicates that Nunjucks is looking for a closing#}.Nunjucks is used by Hexo to render tags. It is IMHO a stupid design since it mixes two languages together (and Hexo tries to parse Nunjucks with regular expressions). This is extremely annoying especially when one uses
{}in maths environment or in code blocks.So in your case, adding a space after the bracket makes it no longer a piece of Nunjucks code. If one does not use Nunjucks tags at all, one could turn off Nunjucks rendering. how this is done varies with which renderer one uses, but in general the line
module.exports.disableNunjucks = true;needs to be somewhere in the renderer plugin.