Hexo 5.1.0, hexo-renderer-marked 3.1.0, hexo-math 4.0.0 & hexo-util 2.4.0 released

Hexo 5.1.0

Features

  • feat(highlight): parse ‘caption’ option to prismHighlight @curbengh #4476

    • caption is now available in prismjs:
      _config.yml
      highlight:
      enable: false
      prismjs:
      enable: true
    • It can be used in triple backtick codeblock:
      ``` js caption
      console.log('foo')
      ```
      • above codeblock will be rendered as:
        (class attributes are omitted for brevity)
        <pre><div class="caption"><span>caption</span></div><code>console...</code></pre>
      • you can style the caption by:
        pre div.caption {
        font-size: 0.9em;
        color: #888;
        }

        pre div.caption a {
        float: right;
        }
    • also available via codeblock and include_code tag plugins.
  • fix: refactor post escape @SukkaW #4472

    • fixed issue with prismjs that, in some cases, did not remove hexo’s processing tag properly
  • Remove plugins option in config @stevenjoezhang #4475

    # _config.yml
    plugins:
    • plugins option has been deprecated long ago and it’s now completely dropped
    • plugins should be saved in scripts/ folder or installed via npm package.json.

Performance

  • perf(backtick_code): avoid duplicated escaping @SukkaW #4478

Hexo 5.0.2

Changes

  • Revert “perf: avoid running plugins in ‘clean’ command” #4386 @curbengh #4470
    • This fixes error in hexo clean.

Hexo 5.0.1

Changes


hexo-renderer-marked 3.1.0

Features

  • feat: postAsset to prepend post’s relative path #159

    • With this feature, asset_img tag plugin is no longer required.
    • Only applies to post_asset_folder
    • An example is “image.jpg” is located at “/2020/01/02/foo/image.jpg”, which is a post asset of “/2020/01/02/foo/“.
      • ![](image.jpg) becomes <img src="/2020/01/02/foo/image.jpg">
    • To enable:
      _config.yml
      post_asset_folder: true
      marked:
      prependRoot: true
      postAsset: true
  • feat: lazyload #156

    • Load image only when it’s coming into view. Explainer
    • loading="lazy" will be injected to every image embed <img>.
    • Only takes effect on supported browsers.
    • To enable:
      marked:
      lazyload: true

Dependency

  • chore(deps-dev): bump hexo from 4.2.1 to 5.0.0 #158

hexo-math 4.0.0

Breaking change

  • The syntax is changed to tag plugin syntax {% %} #130

    • Examples:
      {% katex %}
      c = \pm\sqrt{a^2 + b^2}
      {% endkatex %}
    {% mathjax %}
    \frac{1}{x^2-1}
    {% endmathjax %}
    • The renderer option is highly customizable and it can be different across posts and even within a post, refer to the documentation for usage guide.
    • If you prefer to use $...$ syntax, we recommend hexo-filter-mathjax which is also developed a Hexo developer, @stevenjoezhang.

Misc

  • Drop Travis CI #134

hexo-util 2.4.0

Breaking change

  • fix(highlight): use <div> when wrap is disabled @curbengh #229
    • when wrap is disabled:
      _config.yml
      highlight:
      wrap: false # defaults to true
    • previously, caption is rendered as:
      <pre>
      <figcaption>caption</figcaption>
      <code></code>
      </pre>
    • it’s now rendered as:
      <pre>
      <div class="caption">caption</div>
      <code></code>
      </pre>

Feature

  • feat(prism): caption @curbengh #227
    • caption is rendered as:
      <pre>
      <div class="caption">caption</div>
      <code></code>
      </pre>

hexo-util 2.3.0

Changes

  • feat(highlight): support ‘tab’ & ‘mark’ when wrap is disabled @curbengh #225

    • Previously tab and mark options were only availble when wrap is enabled, now they are also available even when wrap is disabled.
    • Example:
      _config.yml
      highlight:
      tab_replace: ' '
      wrap: false
    {% codeblock lang:js mark:2,5 %}
    const input = [
    { name: 'lorem', item: 'ipsum' },
    { name: 'per', item: 'doming' },
    { name: 'dolor', item: 'lorem' },
    { name: 'usu', item: 'pericula' }
    ]
    {% endcodeblock %}
  • ci: drop appveyor @curbengh #224

  • docs(spawn): link to upstream docs @curbengh #223

hexo-util 2.2.0

Features

  • perf(cache): Use faster Map instead of Object. @SukkaW #209
  • feat(cache): cache#dump & cache#size @SukkaW #209
    // Output number of key-value pairs
    cache.size();
    // 3

    // Outputs everything in cache
    cache.dump();
    /*
    {
    foo: 'bar',
    baz: 123,
    qux: 456
    }
    */

Fixes

  • Support string argument in spawn() @curbengh #220

    • Previously spawn() only supports array argument:
      spawn('cat', ['test.txt']).then((content) => {
      console.log(content);
      });
    • Now string argument is also valid:
      spawn('cat', 'test.txt').then((content) => {
      console.log(content);
      });
  • fix(highlight): support caption when wrap is disabled @curbengh #210

    _config.yml
    highlight:
    wrap: false
    ```js caption
    const hi = 'bob'
    ```

Housekeeping

Dependencies

  • chore(deps-dev): bump mocha from 7.2.0 to 8.0.1 #211
  • chore(deps-dev): bump eslint from 6.8.0 to 7.0.0 #207

hexo-util 2.1.0

Breaking change

Refactor


hexo-util 2.0.0

Breaking change

Fix

Misc

Dependencies

  • chore(deps-dev): bump rewire from 4.0.1 to 5.0.0 #187