From 1127fb4cd5698436cbfcd4606c0e5216dd0cbaf0 Mon Sep 17 00:00:00 2001 From: ache Date: Thu, 3 Nov 2022 01:50:53 +0100 Subject: Add picture support --- package.json | 1 + src/build/to-html.mjs | 7 +++++++ 2 files changed, 8 insertions(+) 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) -- cgit v1.2.3