hexo支持Github Alerts

Note

Useful information that users should know, even when skimming content.

Tip

Helpful advice for doing things better or more easily.

Important

Key information users need to know to achieve their goal.

Warning

Urgent info that needs immediate user attention to avoid problems.

Caution

Advises about risks or negative outcomes of certain actions.

test.mjs

https://www.npmjs.com/package/remark-github-blockquote-alert

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { remark } from 'remark'
import remarkParse from 'remark-parse'
import remarkAlert from 'remark-github-blockquote-alert'
import remarkRehype from 'remark-rehype'
import rehypeStringify from 'rehype-stringify'

let markdown = `
> [!NOTE]
> Useful information that users should know, even when skimming content.

> [!TIP]
> Helpful advice for doing things better or more easily.

> [!IMPORTANT]
> Key information users need to know to achieve their goal.

> [!WARNING]
> Urgent info that needs immediate user attention to avoid problems.

> [!CAUTION]
> Advises about risks or negative outcomes of certain actions.
`;

const htmlStr = remark()
.use(remarkParse)
.use(remarkAlert)
.use(remarkRehype)
.use(rehypeStringify)
.processSync(markdown).toString()

console.log(htmlStr)
1
2
3
4
5
6
7
8
9
export LUA_PATH="$(pwd)/lua/?.lua"

pandoc --from=gfm+alerts \
--to=html5 --mathjax \
--metadata=pagetitle:ignored \
--metadata=standalone:true \
--lua-filter=lua/image-asset.lua \
-o test.html \
test.md