Extended Markdown syntax
This post shows tag plugins, an extension of Markdown syntax, in Hexo static site generator and the Next theme documentation
Some of the built-in tags have been dropped (gist, youtube, jsfiddle, and vimeo). If you use those tags in your existing blog posts, you can install hexo-tag-embed
to continue using them with Hexo v7.0.0.
Quotes
Centered Quote
Centered Quote@Hexo
1 | {% centerquote %}Something{% endcenterquote %} |
Elegant in code, simple in core
Pull Quote
Pull Quote@Hexo
Similar to the regular markdown >
quote.
1 | {% pullquote %} |
content
Block Quote
Block Quote @ Hexo
With author and book title.
1 | {% blockquote David Levithan, Wide Awake %} |
Do not just seek happiness for yourself. Seek happiness for all. Through kindness. Through mercy.
Code blocks
Hexo tag plugin
Code Block @ Hexo
1 | {% codeblock [title] [lang:language] [url] [link text] [additional options] %} |
1 | _.compact([0, 1, false, 2, '', 3]); |
Include code
Include Code @ Hexo
The directory containing code is defined at code_dir
option in _config.yml
, default to code_dir: downloads/code
, corresponding to ${SITE}/source/downloads/code
1 | {% include_code [title] [lang:language] [from:line] [to:line] path/to/file %} |
1 | {% include_code lang:bash bootstrap-conda.sh %} |
Link to other post
Include Posts @ Hexo
1 | {% post_link filename [title] [escape] %} |
Image
Image@Hexo
1 |
|
Videos
Direct URL
video @ Next
1 | {% video https://upload.wikimedia.org/wikipedia/commons/transcoded/c/c4/Physicsworks.ogv/Physicsworks.ogv.240p.vp9.webm %} |
PDF files
pdf @ Next
You'll need to enable pdf
support in next theme's config
1 | pdf: |
1 | {% pdf url [height] %} |
- Only browsers supporting PDF embedding are supported.
- PDF file loading may be block by the CORS policy.
Note
note @ Next. Similar to admonitions @ Hugo LoveIt.
1 | # Note tag (bs-callout) |
1 | {% note %} |
Tabs
tabs @ Next
1 | {% tabs Sixth Unique name %} |
This is Tab 1.
This is Tab 2.
This is Tab 3.
Define a tab via <!-- tab title @icon --> ... <!-- endtab -->
. Both title
and font
are optional.
Label
label @ Next
Similar to ==mark==
in markdown-it
, but with more options.
1 | Lorem {% label @ipsum %} {% label primary@dolor sit %} amet, consectetur {% label success@adipiscing elit, %} sed {% label info@do eiusmod %} tempor incididunt ut labore et dolore magna aliqua. |
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Button
button @ Next
1 | {% btn #, Text %}{% btn #, Text & Title,, Title %} |
Text & Icon (buggy) Text & Icon (fixed width)
Others
- link-grid
- iframes
- Group Pictures
- Caniuse