Skip to content
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

How to set next's _config.yml when using hexo-renderer-pandoc [solved] #10

Closed
3 tasks done
sli1989 opened this issue Jan 5, 2018 · 15 comments
Closed
3 tasks done

Comments

@sli1989
Copy link
Collaborator

sli1989 commented Jan 5, 2018

I agree and want to create new issue


Expected behavior

hexo generate successfully and completely display equation

Actual behavior

when using hexo-renderer-pandoc (new version 0.2.1) in next (version 5.1.4 and 6.0.0), adding if(config.template) args.push("--template=" + config.template); in index.js leads to TypeError: Cannot read property 'template' of undefined when hexo generate...
Remove the if(config.template) args.push("--template=" + config.template);, it works.
On the other hand, according to the guideline in hexo-renderer-pandoc how to set pandoc _config.yml to avoid the undefined of template , thank you for your help.

pandoc:
  filters:
  extra:
  template:
  meta:
  mathEngine:

the guideline in hexo-renderer-pandoc:

  • template is a template file you wish to use when pandoc generates your posts:
template: dir/.../template.html

will be passed to pandoc as --template=dir/../template.html

The path of the template should be relative to the root of your blog.

For example, the very simple template

$if(toc)$
<div id="$idprefix$TOC">
$toc$
</div>
$endif$
$body$

prepends table of contents to all your posts if variable --toc is also passed. To enable TOC, add to your _config.yml:

pandoc:
  \# other options
  extra:
    - toc: \# will be passed as `--toc`. Note the colon
  template: dir/../template.html

besides, the menu bar & it's icon/Site'description/pages toc are all gone in next (version 6.0.0) may due to personalized setting...

the lists of personalized setting in next:

- `next/layout/_macro/post.swig`
- `next\layout\_layout.swig`
- `\next\layout\_my`,
- `next/layout/_third-party/search/localsearch.swig`
- `next\layout\_partials\head.swig`
- `next/layout/_partials/share/baidushare.swig`
- `\next\layout\_partials\footer.swig`
- `next/source/css/_variables/base.styl`
- `next/source/css/_custom/custom.styl`
- `next/source/css/_common/components/post/post-expand.styl`
- `next/source/css/_common/components/post/post-reward.styl`
- `next/languages/zh-hans`
- `next/source/js/custom.js`

Steps to reproduce the behavior

  1. npm uninstall hexo-renderer-marked --save
  2. npm install hexo-renderer-pandoc --save
  3. TypeError: Cannot read property 'template' of undefined when hexo generate
  4. npm uninstall hexo-renderer-pandoc --save
  5. npm install hexo-renderer-marked --save
  6. successfully when hexo generate
  • Link to demo site with this issue: N/A
  • Link(s) to source code or any usefull link(s): N/A

Node.js and NPM Information

"hexo": {
    "version": "3.4.4"
  },
  "dependencies": {
    "hexo": "^3.2.0",
    "hexo-deployer-git": "^0.3.1",
    "hexo-generator-archive": "^0.1.4",
    "hexo-generator-category": "^0.1.3",
    "hexo-generator-feed": "^1.2.2",
    "hexo-generator-index": "^0.2.0",
    "hexo-generator-searchdb": "^1.0.8",
    "hexo-generator-sitemap": "^1.2.0",
    "hexo-generator-tag": "^0.2.0",
    "hexo-generator-topindex": "^0.3.0",
    "hexo-renderer-ejs": "^0.3.0",
    "hexo-renderer-pandoc": "^0.2.1",
    "hexo-renderer-stylus": "^0.3.1",
    "hexo-server": "^0.2.0",
    "hexo-wordcount": "^3.0.2"

Hexo Information


Package dependencies Information


NexT Information

NexT Version:

[x] Latest Master branch.
[x] Latest Release version.
[] Old version -

NexT Scheme:

[] All schemes
[] Muse
[] Mist
[x] Pisces
[] Gemini

Other Information

@ivan-nginx
Copy link
Member

ivan-nginx commented Jan 8, 2018

Can u please provaide all possible links to same issue from @iissnan repo to close them later?
One link already set, is there any another links?

@sli1989
Copy link
Collaborator Author

sli1989 commented Jan 8, 2018

@ivan-nginx the lists of opened issues: #2024#1637#2058

@ivan-nginx
Copy link
Member

@sli1989 Thank you!

@ivan-nginx
Copy link
Member

So, what about here?

@sli1989
Copy link
Collaborator Author

sli1989 commented Jan 8, 2018

still need to Romove the if(config.template) args.push("--template=" + config.template); in hexo\node_modules\hexo-renderer-pandoc\index.js.
i think it's the problem of the new version of hexo-renderer-pandoc, undefined of template


FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
TypeError: Cannot read property 'template' of undefined
    at Hexo.pandocRenderer (F:\LISAI\alex\hexo\node_modules\hexo-renderer-pandoc\index.js:56:12)
    at Hexo.tryCatcher (F:\LISAI\alex\hexo\node_modules\bluebird\js\release\util.js:16:23)
    at Hexo.ret (eval at makeNodePromisifiedEval (C:\Users\Administrator\AppData\Roaming\npm\node_modules\hexo-cli\node_modules\bluebird\js\release\promisify.js:184:12), <anonymous>:13:39)
    at F:\LISAI\alex\hexo\node_modules\hexo\lib\hexo\render.js:61:21
    at tryCatcher (F:\LISAI\alex\hexo\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (F:\LISAI\alex\hexo\node_modules\bluebird\js\release\promise.js:512:31)
    at Promise._settlePromise (F:\LISAI\alex\hexo\node_modules\bluebird\js\release\promise.js:569:18)
    at Promise._settlePromiseCtx (F:\LISAI\alex\hexo\node_modules\bluebird\js\release\promise.js:606:10)
    at Async._drainQueue (F:\LISAI\alex\hexo\node_modules\bluebird\js\release\async.js:138:12)
    at Async._drainQueues (F:\LISAI\alex\hexo\node_modules\bluebird\js\release\async.js:143:10)
    at Immediate.Async.drainQueues (F:\LISAI\alex\hexo\node_modules\bluebird\js\release\async.js:17:14)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)

@ivan-nginx
Copy link
Member

ivan-nginx commented Jan 8, 2018

@sli1989 so, we can post this issue in hexo-renderer-pandoc and explain this, right? I can't to edit external repositories. 😃


Oooh, already done. Well, need just to wait response from author.

@sli1989
Copy link
Collaborator Author

sli1989 commented Jan 8, 2018

i have report the issue in that repo.

@sli1989
Copy link
Collaborator Author

sli1989 commented Jan 8, 2018

in the new version of hexo-renderer-pandoc, a template option is added in configuration .
is there any possible to add corresponding settings in next? like set pandoc in theme's _config.yml.

@ivan-nginx
Copy link
Member

ivan-nginx commented Jan 8, 2018

This is only readme commit. Need to see this.

And as i see need just to comment template option to bypass it. Try it.

pandoc:
  filters:
  extra:
#  template:
  meta:
  mathEngine:

P.S. Not romove, but remove — 去掉 — Удалить.

@sli1989
Copy link
Collaborator Author

sli1989 commented Jan 8, 2018

still Cannot read property 'template' of undefined.
the templates instruction in pandoc.

@ivan-nginx
Copy link
Member

ivan-nginx commented Jan 8, 2018

Try to change this:

-  if(config.template) args.push("--template=" + config.template);
+  if(config.template) {
+    args.push("--template=" + config.template);
+  }

@sli1989
Copy link
Collaborator Author

sli1989 commented Jan 8, 2018

if change the file, just comment it.
the problems is that i want to add configuration in theme's _config.yml to realize the ci automatically.
thank u your help, maybe need to wait author's response.

@sli1989
Copy link
Collaborator Author

sli1989 commented Jan 9, 2018

@ivan-nginx you can close the issue.
if you want to use hexo-renderer-pandoc(new version) in hexo , you must add default configuration in the site's _config.yml not the theme's. I would never have thought of doing that.

pandoc:
  filters:
  extra:
  template: 
  meta:
  mathEngine:

@ivan-nginx
Copy link
Member

ivan-nginx commented Jan 9, 2018

@sli1989 so, all works as i saw before? Let me repeat this steps:

  1. Add in root Hexo _config.yml:
    pandoc:
      filters:
      extra:
      template: 
      meta:
      mathEngine:
    
  2. No need to comment template: option in this configuration.
  3. No errors at generation. All works fine in accorduance with Suggestion to modify the mathjax code [solved] #19 issue.

That's right?

@sli1989
Copy link
Collaborator Author

sli1989 commented Jan 9, 2018

yes, just Add default configuration in root Hexo _config.yml and ensure that mathjax's cdn is working.
i think it's just need a definition, even comment template: option, it works as well.

@ivan-nginx ivan-nginx changed the title how to set next's _config.yml when using hexo-renderer-pandoc how to set next's _config.yml when using hexo-renderer-pandoc [pandoc's config must be in root Hexo config] Jan 9, 2018
@ivan-nginx ivan-nginx added the Hexo label Jan 9, 2018
@ivan-nginx ivan-nginx changed the title how to set next's _config.yml when using hexo-renderer-pandoc [pandoc's config must be in root Hexo config] how to set next's _config.yml when using hexo-renderer-pandoc [solved] Mar 4, 2019
@ivan-nginx ivan-nginx changed the title how to set next's _config.yml when using hexo-renderer-pandoc [solved] How to set next's _config.yml when using hexo-renderer-pandoc [solved] Apr 1, 2019
@theme-next theme-next locked as resolved and limited conversation to collaborators Apr 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants