hexojs / hexo-renderer-pandoc

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

remove a harmless warning message #26

Closed Ritsuka314 closed 5 years ago

Ritsuka314 commented 5 years ago

I encountered the following when generating the site using this plugin:

Error: [WARNING] This document format requires a nonempty <title> element.
  Please specify either 'title' or 'pagetitle' in the metadata.
  Falling back to 'Untitled'

What happened is that HTML5, and so does Pandoc, requires a title to be specified for the output. The warning message is then caught on this line. It then propagates to this line and triggered this line to issue the error.

The issue is that this warning is harmless and should not become an error. So I propose this solution.

I originally wanted to match the result on this line to the warning message and filter it out, but turned out that one warning message can span multiple data events, i.e., it can be returned in pieces. So I decided to wait until the very end to remove this particular warning message.

===

Added on Feb 5, 2019

I found a similar warning message. This one replaced the previous one since https://github.com/jgm/pandoc/commit/f8879ee0a1f00bcf1ead9dce0576c381cbcae778#diff-d4eaae919c702ecf1769ce3a7548cc75

Error: [WARNING] This document format requires a nonempty <title> element.
  Please specify either 'title' or 'pagetitle' in the metadata,
  e.g. by using --metadata pagetitle=\"...\" on the command line.
  Falling back to 'Untitled'