hexojs / hexo-renderer-pandoc

A pandoc-markdown-flavor renderer for hexo.
https://npmjs.com/hexo-renderer-pandoc
MIT License
118 stars 33 forks source link

Renderer Errors with filter pandoc-citeproc in clean directory #28

Closed undefinedMethod closed 5 years ago

undefinedMethod commented 5 years ago

pandoc renderer errors if used with pandoc-citeproc on clean directory

if pandoc renderer is run on hexo generate without filter pages render then render citations if pandoc-citeproc is added to filters in config.yml

The plugin then errors if the directory is cleaned with hexo clean cmd and run again.

Error: pandoc-citeproc: reference undefinedmethod not found pandoc-citeproc: reference undefinedmethod not found

Ritsuka314 commented 5 years ago

I believe the issue is not related to hexo clean.

I think what happened to @undefinedMethod is that pandoc warned when certain references are not defined, in which case pandoc simply proceeded and generated the following

<span class="citation" data-cites="nonexistent">(<span class="citeproc-not-found" data-reference-id="nonexistent"><strong>???</strong></span>)</span>

which is rendered as (???).

What went wrong is in this plugin we capture everything from stderr and blocked hexo if there is anything.

This has caused issue before: https://github.com/wzpan/hexo-renderer-pandoc/pull/26

What I think we need is a way to separate warnings from actual issues. Sad thing is, since stderr is more like standard non-output, it is not easy. I will investigate this. One obvious way is pass --quiet to pandoc to suppress all warnings, but I do not like it. I am currently thinking about determining presence of error from pandoc return code, and then simply display all warnings and proceed if no error. I would like to confirm that pandoc uses return code consistently.

Also, while I am writing this, the issue is closed by the original reporter. May I ask why this issue is no longer a concern? I can certainly reopen this issue.

undefinedMethod commented 5 years ago

@RichardYan314 My apologies,

It appears that a twitter link using the @ symbol was being misread by pandoc-citeproc as a citation link, When I reformatted that link the issue was resolved.

Ritsuka314 commented 5 years ago

@undefinedMethod Good to hear that your particular issue has been resolved. But still, you exposed one potential issue that when a reference item is undefined, or more generally, when pandoc sends a warning, this plugin blocks hexo. I will open a separate issue so you will not be bothered by GH notifications. Thanks