Expansion Plugins
Edit this page on GitHubCode Highlight
Hexo comes with two built-in code highlighting plugins - highlight.js and prismjs. highlight.js is further divided into customized highlight.js for “Cards” and the original highlight.js. This corresponds to three versions: customized highlight.js for “Cards” (highlight
), original highlight.js (hljs
), and prismjs (prismjs
).
highlight
Configure the highlight in the site configuration file. Make sure that enable
is set to true
, hljs
is set to false
, and prismjs.enable
is set to false
.
|
Customized highlight.js for Hexo cannot be used directly with highlight.js themes. Therefore, “Cards” has customized code highlighting themes to fit better with the overall style.
Since the readability of many code highlighting themes varies greatly between light/dark mode, the code highlighting theme used in each mode can be set separately under the style
in the theme configuration file.
|
default
: default code highlighting themedarkmode
: code highlighting theme used in dark mode
Only the name of the highlight theme needs to be filled in here, and no need to include the path or suffix. “Cards” will automatically complete it when requested. The vendor for highlight themes can be configured in vendors.highlight
.
hljs
Configure the highlight in the site configuration file. Make sure that enable
and hljs
are both set to true, line_number
and wrap
are both set to false
, and prismjs.enable
is set to false
.
|
Original highlight.js can use themes provided by highlight.js directly. Similarly, in the theme configuration file, the highlight theme used in each mode can be set separately under the style.hljs
. The vendor for highlight themes can be configured in vendors.hljs
.
prismjs
Configure the prismjs in the site configuration file. Make sure that enable
and preprocess
are both set to true
, and highlight.enable
is set to false
.
|
prismjs supports using themes provided by itself directly. In the theme configuration file, the highlight theme used in each mode can be set separately under the style.prismjs
.
|
default
: default code highlighting themedarkmode
: code highlighting theme used in dark mode
Similarly, only the name of the highlight theme needs to be filled in here, without the need to specify the path or suffix. “Cards” will automatically complete it when making the request. The vendor for highlight themes can be configured in vendors.prismjs
.
MathJax
Add the following front-matter
to any article that requires mathematical formula rendering:
|
If you have changed the renderer, adjust according to your actual situation.
Image Lazyload
“Cards” comes with a Lazyload plugin for images. To avoid conflicts, do not install other plugins.
Starting from “Cards” v1.1.0, you do NOT need to move the lazyload configuration to the site configuration file. You can directly modify the theme configuration file to make the relevant configuration effective.
|
onlypost
: Enable image lazyload only on article pagesloadingImage
: Placeholder image for lazyload
Local Search
“Cards” has a built-in site search function. To avoid conflicts, do not install other plugins. Before enabling it, you need to generate a separate page for it.
Starting from “Cards” v1.1.0, you do NOT need to move the search configuration to the site configuration file. You can directly modify the theme configuration file to make the relevant configuration effective.
|
path
: Path to the generated website databasefield
: Data acquisition range (Page | Post | All)
Tag Plugin
The Tag plugin enriches the style of quote block.
|
To use this plugin in an article:
|
[ type ]
is optional and can be filled with info
, important
, tip
, caution
, or warning
, corresponding to five different styles. You can go to the theme demo to see the style preview.
Content Folding
Use the Content Folding plugin to fold any content section within an article.
|
summary
: default folding titlemotion
: adds a vertical slide animation when folding/unfolding
To use this plugin in an article:
|
If you want a folding box to be expanded by default:
|
fancyBox
fancyBox is a jQuery lightbox script for displaying images, videos and more when touched. You can go to the Demo page for images to test its effect. Since “Cards” has customized its own Lazyload function, even if you enable image lazyload, Fancybox can still be well compatible with it.
|
Setting enable: true
enables fancyBox. By default, it is not applied to all images. To apply fancyBox to a specific image, wrap it with the <fancybox>
tag, for example:
|
If you set auto: true
, it will be automatically applied to all images without the need to wrap them in the <fancybox>
tag.
Back to Top
The Back to Top button.
|
Dark Mode
Dark mode, controlled by the visitor’s terminal prefers-color-scheme
parameter, also adds a manual switch button.
|