Skip to content

Commit c9b43ea

Browse files
authored
feat(docs): add file/language type icons to code blocks (denoland#3162)
I originally wanted to make it clearer the distinction between "files" and e.g. `` ```tsx foo.tsx `` compared to `` ```sh Terminal `` or `` ```txt Project structure``. I originally started just trying to add a 📝 icon or something. But instead I ended showing file types of all markdown languages. I took the file type icons for the SVG's from https://github.com/vscode-icons/vscode-icons, which has a MIT license. I think the icons make it a even more clear what the language of the code snippet is. I have a follow-up PR for improving code block titles and making examples more consistent in denoland#3163. ## Comparisons <details> <summary><strong>Open &mdash; Before | After</strong></summary> ### TS + Shell icons - Hover tooltips and alt text <img width="1504" height="639" alt="image" src="https://github.com/user-attachments/assets/636838a3-f38c-4048-a536-52c1cdd6b6d4" /> ### TS + Shell icons 2 <img width="1511" height="761" alt="image" src="https://github.com/user-attachments/assets/2ad6d25c-3995-433a-ad93-162830ca55a1" /> ### Shell + Dockerfile icons <img width="1500" height="780" alt="image" src="https://github.com/user-attachments/assets/88010749-d0d2-4498-9eb2-9bd971e48365" /> ### Nested blocks + Git icon <img width="1513" height="634" alt="image" src="https://github.com/user-attachments/assets/400c27f8-d0b4-40bd-801d-611e1e8a8e36" /> </details>
1 parent 62f8bb0 commit c9b43ea

16 files changed

Lines changed: 102 additions & 11 deletions

File tree

docs/canary/concepts/static-files.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ const builder = new Builder({ staticDir: "path/to/staticDir" });
3030
By default, Fresh adds caching headers for the `src` and `srcset` attributes on
3131
`<img>` and `<source>` tags.
3232

33-
```jsx
33+
```tsx
3434
// Caching headers will be automatically added
3535
<img src="/user.png" />;
3636
```
3737

3838
You can always opt out of this behaviour per tag, by adding the
3939
`data-fresh-disable-lock` attribute.
4040

41-
```jsx
41+
```tsx
4242
// Opt-out of automatic caching headers
4343
<img src="/user.png" data-fresh-disable-lock />;
4444
```
@@ -48,7 +48,7 @@ You can always opt out of this behaviour per tag, by adding the
4848
Use the `asset()` function to add caching headers manually. It will be served
4949
with a cache lifetime of one year.
5050

51-
```jsx
51+
```tsx
5252
import { asset } from "fresh/runtime";
5353

5454
// Adding caching headers manually

docs/latest/concepts/server-configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ The `basePath` will be automatically applied to absolute links in your app. For
151151
example, when the `basePath` is `/foo/bar`, linking to `/about` will
152152
automatically become `/foo/bar/about`.
153153

154-
```jsx
154+
```tsx
155155
<a href="/about">About</a>;
156156
```
157157

docs/latest/concepts/static-files.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ version of this path that contains a build ID for cache busting. When the asset
2929
is requested at this "locked" path, it will be served with a cache lifetime of
3030
one year.
3131

32-
```jsx routes/page.tsx
32+
```tsx routes/page.tsx
3333
import { asset } from "$fresh/runtime.ts";
3434

3535
export default function Page() {
@@ -46,6 +46,6 @@ and `<source>` HTML tags. These will automatically use "locked" paths if Fresh
4646
deems it safe to do so. You can always opt out of this behaviour per tag, by
4747
adding the `data-fresh-disable-lock` attribute.
4848

49-
```jsx
49+
```tsx
5050
<img src="/user.png" />;
5151
```

docs/latest/examples/rendering-markdown.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ description: testFromText
9292

9393
You'll also need to import the `Github Flavored Markdown` module:
9494

95-
```bash
95+
```sh
9696
deno add jsr:@deno/gfm
9797
```
9898

docs/latest/getting-started/running-locally.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ you add a new route.
3838
If you want to change the port or host, modify the config bag of the `start()`
3939
call in `main.ts` to include an explicit port number:
4040

41-
```js main.ts
41+
```ts main.ts
4242
await start(manifest, { server: { port: 3000 } });
4343
```
4444

www/static/logos/css.svg

Lines changed: 1 addition & 0 deletions
Loading

www/static/logos/diff.svg

Lines changed: 1 addition & 0 deletions
Loading

www/static/logos/docker.svg

Lines changed: 1 addition & 0 deletions
Loading

www/static/logos/git.svg

Lines changed: 1 addition & 0 deletions
Loading

www/static/logos/html.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)