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
andinclude_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 npmpackage.json
.
Performance
Hexo 5.0.2
Changes
- Revert “perf: avoid running plugins in ‘clean’ command” #4386 @curbengh #4470
- This fixes error in
hexo clean
.
- This fixes error in
Hexo 5.0.1
Changes
- fix(helpers): call url_for from hexo-util @curbengh #4447
- perf(external_link): update regexp @SukkaW #4467
- regex of
external_link
filter now pre-match external links, instead of solely rely onisExternalLink
- regex of
- perf(injector): shorthand optimization @SukkaW #4462
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- With this feature,
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>- when
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
andmark
options were only availble whenwrap
is enabled, now they are also available even whenwrap
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 %}- Previously
docs(spawn): link to upstream docs @curbengh #223
spawn()
is a nice wrapper aroundchild_process.spawn()
, so it supports similar options.
hexo-util 2.2.0
Features
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);
});- Previously
fix(highlight): support caption when wrap is disabled @curbengh #210
_config.yml highlight:
wrap: false```js caption const hi = 'bob' ```
Housekeeping
- Drop Node 13 from CI @curbengh #219
- refactor(encode/decode_url): replace decodeURI with native querystring.unescape @curbengh #214
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
- Remove
HashStream()
function @curbengh #198- Deprecated in #45, part of v1.0.0 release
- Replaced by
createSha1Hash()
Refactor
hexo-util 2.0.0
Breaking change
- Drop support of Node 8 @SukkaW #191 #193
- Requires
autoDetect
to be enabled andlang
to be unset to use sublanguagehighlight()
@curbengh #192 #196
Fix
- Fix
CacheStream()
compatibility issue with Node 14 @curbengh #195
Misc
- docs(isExternalLink): add JSDoc @YoshinoriN #190
Dependencies
- chore(deps-dev): bump rewire from 4.0.1 to 5.0.0 #187