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

EJS template is blind and don't know when }} is not for him #3259

noraj opened this Issue Sep 10, 2018 · 0 comments


1 participant

noraj commented Sep 10, 2018

Environment Info

Node version(node -v): v10.9.0

Hexo and Plugin version(npm ls --depth 0):

├── hexo@3.7.1
├── hexo-deployer-git@0.3.1
├── hexo-generator-archive@0.1.5
├── hexo-generator-category@0.1.3
├── hexo-generator-feed@1.2.2
├── hexo-generator-json-content@3.0.1
├── hexo-generator-tag@0.2.0
├── hexo-i18n@0.2.1
├── hexo-multiauthor@0.0.1
├── hexo-pagination@0.1.0
├── hexo-renderer-ejs@0.3.1
├── hexo-renderer-markdown-it@3.4.1
├── hexo-renderer-stylus@0.3.3
├── hexo-server@0.3.3
├── hexo-sliding-spoiler@1.1.6
├── hexo-tag-asciinema@0.0.1
└── hexo-tag-bootstrap@0.1.2


I think I get this error message an hundred times:

Template render error: (unknown path) [Line 69, Column 34]
  unexpected token: }}
    at Object._prettifyError (/home/shark/Dev/hexo_rawsec/node_modules/nunjucks/src/lib.js:36:11)
    at Template.render (/home/shark/Dev/hexo_rawsec/node_modules/nunjucks/src/environment.js:524:21)
    at Environment.renderString (/home/shark/Dev/hexo_rawsec/node_modules/nunjucks/src/environment.js:362:17)
    at Promise (/home/shark/Dev/hexo_rawsec/node_modules/hexo/lib/extend/tag.js:66:9)
    at Promise._execute (/home/shark/Dev/hexo_rawsec/node_modules/bluebird/js/release/debuggability.js:303:9)
    at Promise._resolveFromExecutor (/home/shark/Dev/hexo_rawsec/node_modules/bluebird/js/release/promise.js:483:18)
    at new Promise (/home/shark/Dev/hexo_rawsec/node_modules/bluebird/js/release/promise.js:79:10)
    at Tag.render (/home/shark/Dev/hexo_rawsec/node_modules/hexo/lib/extend/tag.js:64:10)
    at Object.tagFilter [as onRenderEnd] (/home/shark/Dev/hexo_rawsec/node_modules/hexo/lib/hexo/post.js:230:16)
    at Promise.then.then.result (/home/shark/Dev/hexo_rawsec/node_modules/hexo/lib/hexo/render.js:65:19)
    at tryCatcher (/home/shark/Dev/hexo_rawsec/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/shark/Dev/hexo_rawsec/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/home/shark/Dev/hexo_rawsec/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/home/shark/Dev/hexo_rawsec/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/shark/Dev/hexo_rawsec/node_modules/bluebird/js/release/promise.js:693:18)
    at Async._drainQueue (/home/shark/Dev/hexo_rawsec/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/home/shark/Dev/hexo_rawsec/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues (/home/shark/Dev/hexo_rawsec/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:693:18)
    at tryOnImmediate (timers.js:664:5)
    at processImmediate (timers.js:646:5)

Because I used {{ or }} in my markdown files. Because I'm writing technical stuff about templating languages for example.
This is making the EJS template engine crash.

But instead of trying to compute all files blindly, Hexo should make the EJS engine aware of the markdown context.

I mean if there is }} or %} ok try to do something with it but if the same pattern is inside markdown inline or fenced block just ignore it, it's not for you silly EJS engine.

Same for other languages (other than markdown) and stuff inside a comment.

The EJS engine is blind, make him some eyes please.

Sometimes even using the {% raw %} tag I can't write the code I want to.

An additional mechanism can be to make a switch to turn off EJS parsing 1) globally in _config.yml and 2) locally inside the file frontammeter.

Not a marked problem. Marked render that as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment