Skip to content

Commit 4f25ab5

Browse files
committed
perf: use next/image in changelog
Still have to do it in blog
1 parent 31d9bfc commit 4f25ab5

File tree

4 files changed

+44
-7
lines changed

4 files changed

+44
-7
lines changed

changelogs/new-changes-trigger/index.mdx

+1-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ slug: new-changes-trigger
55
date: 2024-02-25
66
---
77

8-
<img
9-
className="rounded-lg"
10-
src="/assets/changelogs/new-changes-trigger/added-removed.png"
11-
alt="Added and removed screenshot from Argos in GitHub commit status"
12-
/>
8+
![Added and removed screenshot from Argos in GitHub commit status](/assets/changelogs/new-changes-trigger/added-removed.png)
139

1410
We've listened to your input on how changes to screenshots within Argos should impact your workflow. With our latest update, Argos now treats the addition and removal of screenshots as diffs. This change ensures that any modifications to your visual assets are highlighted and require user approval, enhancing your control over visual consistency across your projects.
1511

lib/changelog-api.tsx

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import fg from "fast-glob";
22
import * as matter from "gray-matter";
33
import { compileMDX } from "next-mdx-remote/rsc";
4+
import Image from "next/image";
45
import { readFile } from "node:fs/promises";
56
import * as React from "react";
67
import rehypeHighlight from "rehype-highlight";
8+
import rehypeImgSize from "rehype-img-size";
79
import remarkFrontmatter from "remark-frontmatter";
810
import remarkGfm from "remark-gfm";
911
import { z } from "zod";
@@ -40,9 +42,23 @@ export async function getDocMdxSource(filepath: string) {
4042
const source = await readFile(filepath, "utf-8");
4143
const result = await compileMDX({
4244
source,
45+
components: {
46+
img: ({ src, height, width, alt, ...rest }) => {
47+
return (
48+
<Image
49+
className="rounded-lg"
50+
src={src as string}
51+
height={height as number}
52+
width={width as number}
53+
alt={alt as string}
54+
/>
55+
);
56+
},
57+
},
4358
options: {
4459
mdxOptions: {
45-
rehypePlugins: [rehypeHighlight],
60+
// @ts-ignore
61+
rehypePlugins: [rehypeHighlight, [rehypeImgSize, { dir: "public" }]],
4662
remarkPlugins: [remarkGfm, remarkFrontmatter],
4763
},
4864
},

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"react-twc": "^1.4.1",
3838
"react-tweet": "^3.2.0",
3939
"rehype-highlight": "^6.0.0",
40+
"rehype-img-size": "^1.0.1",
4041
"remark-frontmatter": "^4.0.1",
4142
"remark-gfm": "^3.0.1",
4243
"shiki": "^0.14.7",

pnpm-lock.yaml

+25-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)