summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorache <ache@ache.one>2022-11-03 01:50:53 +0100
committerache <ache@ache.one>2022-11-03 01:50:53 +0100
commit1127fb4cd5698436cbfcd4606c0e5216dd0cbaf0 (patch)
tree62ad7222e2506ed64f6057ff04693dae1f11d261
parentUse next gen format (diff)
Add picture support
-rw-r--r--package.json1
-rw-r--r--src/build/to-html.mjs7
2 files changed, 8 insertions, 0 deletions
diff --git a/package.json b/package.json
index 48040ce..531dc9f 100644
--- a/package.json
+++ b/package.json
@@ -43,6 +43,7 @@
"mustache": "^4.2.0",
"rehype-autolink-headings": "^6.1.1",
"rehype-highlight": "^5.0.2",
+ "rehype-picture": "^4.0.2",
"rehype-katex": "^6.0.2",
"rehype-raw": "^6.1.1",
"rehype-slug": "^5.0.1",
diff --git a/src/build/to-html.mjs b/src/build/to-html.mjs
index 4bc3c06..adfcd7a 100644
--- a/src/build/to-html.mjs
+++ b/src/build/to-html.mjs
@@ -7,6 +7,7 @@ import remarkMath from 'remark-math';
import remarkFrontmatter from 'remark-frontmatter';
import remarkRehype from 'remark-rehype';
import rehypeSlug from 'rehype-slug';
+import rehypePicture from 'rehype-picture'
import rehypeKaTeX from 'rehype-katex';
import rehypeRaw from 'rehype-raw';
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
@@ -23,6 +24,10 @@ const autoLinkOption = {
},
};
+const pictureOptions = {
+ 'png': {avif: 'image/avif'}
+}
+
const generator = unified()
.use(remarkParse)
.use(remarkGfm)
@@ -34,6 +39,7 @@ const generator = unified()
.use(remarkRehype, {allowDangerousHtml: true})
.use(rehypeRaw)
.use(remarkRemoveFootnoteHeader)
+ .use(rehypePicture, pictureOptions)
.use(rehypeKaTeX)
.use(rehypeSlug)
.use(rehypeHighlight)
@@ -53,6 +59,7 @@ const generatorHTML = unified()
.use(remarkRehype, {allowDangerousHtml: true})
.use(rehypeRaw)
.use(remarkRemoveFootnoteHeader)
+ .use(rehypePicture, pictureOptions)
.use(rehypeKaTeX)
.use(rehypeSlug)
.use(rehypeHighlight)