Hexo 4.2.0, hexo-util 1.8.0 & eslint-config-hexo 4.1.0 released

Hexo 4.2.0

Features

  • Cache rendered HTML is disabled by default in hexo-server #3963
    • It’s disabled so that any changes (particularly to the theme’s layout) can be previewed in real-time.
    • If you use hexo-server in production environment to serve your website, it can be enabled by,
      _config.yml
      server:
      cache: true
  • Add min_depth: option to toc() helper #3997
    • Example usage:
      <%- toc(page.content, { min_depth: 2 }) %>
      // table of content would only include <h2>, <h3> and above

Fixes

  • Merges similar theme configs in main config and theme’s config #3967
    • For example:
      _config.yml
      theme_config:
      a:
      b: 'foo'
    • Plus,
      _config.yml of theme
      a:
      c: 'bar'
    • theme variable should have,
      a: {
      b: 'foo',
      c: 'bar'
      }
  • Fixes some caching issue #3985
  • Open Graph now applies all pretty_urls options to og:url tag #3983

Refactor

  • No longer uses lodash #3969, #3987, #3753
    • Lodash _ is still available as a global variable, usually utilized in theme layout.
    • However, we plan to completely drop it in the coming Hexo 5.0.0
    • This project page includes all the relevant pull requests which you may find useful
  • Completely drops cheerio #3850, #3677
    • This means Hexo no longer includes cheerio as part of its production dependencies (it’s still a development dependency)
    • To continuing use cheerio,
      $ npm install --save cheerio

hexo-util 1.8.0

Features

  • tocObj() to convert headings (e.g. <h1>) in html into JSON format #137
    • Enables headings to be programmatically parsed and manipulated.
    • Created mainly to be used by the toc() helper (ref hexojs/hexo#3850).
  • Cache() class utility #162
    • Mainly to cache user config to avoid unnecessary parsing
    • We have started utilizing caching on many utilities and resulted in up to 20% better performance.

Fixes

  • In htmlTag(), url in <meta> tags (in Facebook Open Graph and Twitter Card) are now percent-encoded, instead of html-escaped. #159
    • url in srcset attribute is now encoded using encodeURL() which supports more url types, instead of encodeURI. #160

eslint-config-hexo 4.1.0

  • must have a space between async and arrow function #28