Skip to content

Commit 8c92c5c

Browse files
Add docs for themed images (#482)
1 parent b704dae commit 8c92c5c

File tree

1 file changed

+28
-12
lines changed

1 file changed

+28
-12
lines changed

building/markdown/markdown.md

+28-12
Original file line numberDiff line numberDiff line change
@@ -149,16 +149,32 @@ You can test that your markdown comment gets removed by checking how your commen
149149
- Inline HTML is allowed, but should be used sparingly
150150
- Always use native markdown alternatives if available (e.g. use `# ...` rather than `<h1>...</h1>`)
151151

152+
## Images
153+
154+
As the website supports light and dark themes, community-submitted images must render well in both themes.
155+
The solution to this is to suffix your image name (before the file extension):
156+
157+
1. Have the image name end in `-invertible` (e.g. `graph-invertible.svg`). The image will automatically be inverted when shown in the dark theme (via `filter: invert(100%)`).
158+
1. Have the image name end in `-light` (e.g. `graph-light.png`) and also create dark-theme compatible version that ends in `-dark` (which would be `graph-dark.png`). We'll automatically render the correct image depending on the user's theme.
159+
160+
Images with neither suffix will be used without modifications across both themes.
161+
This means that if you want to create grayscale images, you can generally make them look good on light theme, and then set them to be invertible.
162+
But if you’re using an image with lots of colours, you might like to make two variants.
163+
164+
The full image name (including `-invertible`) should be added to the markdown where the image is rendered.
165+
For light/dark ones, **ONLY** include the `-light` variant.
166+
This logic is honoured across all markdown docs.
167+
152168
## Linters
153169

154170
There are various rules you can use to configure linters to meet this spec:
155171

156-
- [MD001][MD001]: Enable
157-
- [MD002][MD002]: Enable
158-
- [MD003][MD003]: Use `atx` style
159-
- [MD004][MD004]: Use `dash` style
160-
- [MD013][MD013]: Disable
161-
- [MD033][MD033]: Disable
172+
- [MD001][md001]: Enable
173+
- [MD002][md002]: Enable
174+
- [MD003][md003]: Use `atx` style
175+
- [MD004][md004]: Use `dash` style
176+
- [MD013][md013]: Disable
177+
- [MD033][md033]: Disable
162178

163179
## Auto formatting
164180

@@ -173,12 +189,12 @@ All the above can greatly help reduce churn in reviews, which is frustrating for
173189

174190
---
175191

176-
[MD001]: https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md#md002---header-levels-should-only-increment-by-one-level-at-a-time
177-
[MD002]: https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md#md002---first-header-should-be-a-top-level-header
178-
[MD003]: https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md#md003---header-style
179-
[MD004]: https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md#md004---unordered-list-style
180-
[MD013]: https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md#md013---line-length
181-
[MD033]: https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md#md033---inline-html
192+
[md001]: https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md#md002---header-levels-should-only-increment-by-one-level-at-a-time
193+
[md002]: https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md#md002---first-header-should-be-a-top-level-header
194+
[md003]: https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md#md003---header-style
195+
[md004]: https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md#md004---unordered-list-style
196+
[md013]: https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md#md013---line-length
197+
[md033]: https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md#md033---inline-html
182198
[asciidoctor]: https://asciidoctor.org/docs/asciidoc-recommended-practices/#one-sentence-per-line
183199
[babelmark3]: https://babelmark.github.io
184200
[google-link]: https://google.com

0 commit comments

Comments
 (0)