console/patches/nextra.patch
Piotr Monwid-Olechnowicz 4a865c03b2
Hive Blog (#6625)
Co-authored-by: Dotan Simha <dotansimha@users.noreply.github.com>
2025-03-27 16:12:42 +01:00

26 lines
1.1 KiB
Diff

diff --git a/dist/server/compile.js b/dist/server/compile.js
index 4b3f41397995dd4c796f6945627fb14d43776eb3..889f926c097db987f8e9d262e015ae9a1f89664b 100644
--- a/dist/server/compile.js
+++ b/dist/server/compile.js
@@ -9,6 +9,7 @@ import remarkGfm from "remark-gfm";
import remarkMath from "remark-math";
import remarkReadingTime from "remark-reading-time";
import remarkSmartypants from "remark-smartypants";
+import { rehypeFrontmatterMdxImports } from 'rehype-frontmatter-mdx-imports';
import { MARKDOWN_URL_EXTENSION_RE } from "./constants.js";
import { recmaRewrite } from "./recma-plugins/index.js";
import {
@@ -142,7 +143,12 @@ async function compileMdx(source, {
rehypeTwoslashPopup,
[rehypeAttachCodeMeta, { search }]
],
- rehypeExtractTocContent
+ rehypeExtractTocContent,
+ [rehypeFrontmatterMdxImports, {
+ keys: ['thumbnail', 'image'],
+ importedAssetPathRegex: /(png|jpg|jpeg|gif|webp)$/,
+ fileRegex: /\/blog\/\(posts\)/,
+ }]
].filter((v) => !!v),
recmaPlugins: [
...recmaPlugins || [],