Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Site
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software/vole.git

Self-hosted forge that lives in your Git repo.

Rewrite documentation around reader tasks

d1f44d838966c0a4762073f12375ec7562582fdf · Keenan Nemetz · 21h ago · parent 9103f6a8

docs/media.md −75

@@ -1,75 +0,0 @@
1 # Media previews
2
3 A repository holds more than source text. Vole shows a picture or a 3D model on
4 the surfaces that read a file: the code browser, a commit or compare diff, and
5 the Files tab of a change request. Markdown files use the same image and model
6 support.
7
8 Nothing has to be rendered. A format with no useful source view (a PNG, a binary
9 STL) is shown in place of the source table. A text format that is also a model or
10 an image (SVG, OBJ, ASCII STL, glTF) keeps its source view and gains a `preview`
11 toggle, because the bytes are still the file.
12
13 ## Images
14
15 | Extensions | Served as |
16 |---|---|
17 | `.png` | `image/png` |
18 | `.jpg` `.jpeg` | `image/jpeg` |
19 | `.gif` | `image/gif` |
20 | `.webp` | `image/webp` |
21 | `.avif` | `image/avif` |
22 | `.bmp` | `image/bmp` |
23 | `.ico` | `image/x-icon` |
24 | `.svg` | `image/svg+xml` |
25
26 Raw bytes are served with the image's type, so an `<img>` works. Every other
27 extension stays `text/plain` and the response is `nosniff`, so an HTML file in a
28 repository is never rendered on the forge's origin. An SVG opened directly is
29 made inert by a Content-Security-Policy; as an image it renders normally.
30
31 In a Markdown document, an image path is resolved against the document, not the
32 page it is rendered on. A README beside `images/board.png` names that path. The
33 instance introduction resolves `assets/...` to the customization assets; see
34 [Instance customization](reference/instance-customization.md#images-in-the-introduction).
35
36 An image larger than 32 MiB is a download rather than an inline preview.
37
38 ## 3D models
39
40 | Extension | Format |
41 |---|---|
42 | `.stl` | STL, binary or ASCII |
43 | `.obj` | Wavefront OBJ geometry |
44 | `.gltf` | glTF (JSON) |
45 | `.glb` | glTF (binary) |
46 | `.3mf` | 3D Manufacturing Format |
47
48 The viewer runs in the browser and needs only the file. Drag to turn the model
49 like a turntable: sideways spins it about its own up axis, up and down tips it
50 over the top, and the two mix without rolling it. Scroll, pinch, or use the + and
51 − buttons to zoom; Front, Top and Right put a known side toward you; the
52 remaining buttons reset the view and toggle a wireframe. On a diff the before
53 and after models turn and zoom together, and Sync turns that link off for a
54 reader who wants each side at its own angle and zoom. It is loaded on demand, so
55 a page without a model downloads none of it. Without JavaScript or WebGL, the
56 file's download link stays visible.
57
58 A Markdown document names a model the same way it names a picture: a relative
59 image path whose extension is on the list above. A README can therefore show an
60 assembly beside the prose. The image's alt text labels the preview, and the
61 file's name is what the fallback offers to download. A path in a document that
62 has no place in a tree — an issue body, the instance introduction — stays an
63 image, because there is no raw route behind it for the viewer to fetch.
64
65 A `.gltf` may name buffers and textures beside it; they are fetched through the
66 same raw path. A companion `.mtl` for an `.obj` is not loaded, so an OBJ arrives
67 as geometry with a plain material.
68
69 Compressed glTF assets are not supported. A model that uses Draco, KTX2, or
70 meshopt reports that it could not be loaded and keeps its download link.
71
72 A model larger than 64 MiB is a download rather than an inline preview in the
73 code browser, which reads the file's size before rendering. A Markdown document
74 is rendered from its text alone, so the path is all that decides there: a
75 README's model is offered to the viewer whatever its size.