You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Of these, we prefer Mermaid diagrams because they are searchable and changeable. The "cost" of updating a Mermaid diagram is much lower than re-taking a screenshot or working with a designer to update a diagram.
21
+
22
+
Additionally, you should only use screenshots intentionally, such as when there's a clear user confusion that needs a visual image. [Find account and zone ID](/fundamentals/account/find-account-and-zone-ids/) is a good illustration of this, because it's a common user pain point and one that's very difficult in the current Cloudflare UI.
23
+
24
+
## Maintenance
25
+
26
+
The best way to improve image maintenance is to avoid using them.
27
+
28
+
The other way to streamline maintenance is to remove images that are no longer referenced in your documentation. This pattern becomes particularly helpful if you need to audit images for UI changes or leaked information, because then you are not wasting time looking at unused images too.
29
+
30
+
We do that through a combination of GitHub actions.
31
+
32
+
### Flag unused images
33
+
34
+
We have a specific GitHub action to [flag unused images](https://github.com/cloudflare/cloudflare-docs/blob/production/.github/workflows/image-audit.yml).
35
+
36
+
What it does is:
37
+
38
+
1. Finds all `.png` or `.svg` files in our content.
39
+
2. Checks to see if those files are referenced in any of our MDX files.
40
+
3. If there are unreferenced files, creates a [GitHub issue](https://github.com/cloudflare/cloudflare-docs/issues/23343) listing them out.
41
+
42
+
### Evaluate image paths
43
+
44
+
In combination with [flagging unused images](#flag-unused-images), we also have logic in our [build process](https://github.com/cloudflare/cloudflare-docs/blob/production/astro.config.ts) to validate image paths.
45
+
46
+
<GitHubCode
47
+
repo="cloudflare/cloudflare-docs"
48
+
file="astro.config.ts"
49
+
commit="aaacc3c3c2a7517ee307ddfc56962cbea9847202"
50
+
lang="ts"
51
+
lines="62-76"
52
+
code={{ title: "astro.config.ts", mark: 5 }}
53
+
/>
54
+
55
+
This line ensures that our custom [Remark plugin](https://github.com/cloudflare/cloudflare-docs/blob/production/src/plugins/remark/validate-images.ts) validates all images paths. If the path does not exist, we throw an error and prevent the site from building.
56
+
57
+
<GitHubCode
58
+
repo="cloudflare/cloudflare-docs"
59
+
file="src/plugins/remark/validate-images.ts"
60
+
commit="fdeaadcfa99030d085512e721bc0a5948dcf70d4"
61
+
lang="ts"
62
+
code={{ title: "validate-images.ts" }}
63
+
/>
64
+
65
+
When paired with [flagging unused images](#flag-unused-images), this path validation ensures that a tech writer can safely delete unused files in a PR. So long as the site builds correctly, you have only deleted image files that are not referenced anywhere.
0 commit comments