vole
Clone
Read only, no credentials:
https://rodent.software/git/vole.git
Write over SSH with a registered key:
git clone ssh://git@0.0.0.0:2222/vole.git
A free and open-source forge that lives in your Git repo.
Resolve a README's relative links against the file, not the page
796ccd9051ef49f10655088ec39b8dfb844f4124 · Keenan Nemetz · 13d ago · parent 53ff967b
Resolve a README's relative links against the file, not the page A relative link was resolved by the browser against the URL the README happened to be rendered at, so `docs/getting-started.md` reached `/r/<repo>/docs/getting-started.md` from the overview page and 404'd, and the same link broke differently from the code browser. A document that lives in the tree now carries its own path, and its links and images are rewritten after parsing and before rendering: markdown opens the preview, other files open the source, images point at the raw route, a directory opens the tree, and `.`/`..` resolve the way a reader expects with climbing clamped at the repository root. A destination that already names somewhere — a scheme, `//host`, a site-absolute path, a bare `#anchor` or `?query` — is left alone, and so is any document with no place in a tree, such as an issue body or a comment. The rewrite works on the parsed tree rather than on the markdown text, so reference-style links are covered too, and the source view still shows the file's bytes unchanged. Refs #01M5XF52R132A88C6WEQ6H6BK6
server/web/codebrowser.go +4−2
| @@ -75,7 +75,7 @@ func (w *Web) Code(rw http.ResponseWriter, r *http.Request) { | |||
| 75 | 75 | var readme template.HTML | |
| 76 | 76 | readmeName := "" | |
| 77 | 77 | if commit != "" { | |
| 78 | readme, readmeName = w.readmeAt(m, commit) | ||
| 78 | readme, readmeName = w.readmeAt(m, ref, commit) | ||
| 79 | 79 | } | |
| 80 | 80 | // The README is what the main pane opens with, so it is also the tree row | |
| 81 | 81 | // that should look current when no file has been selected yet. | |
| @@ -232,7 +232,9 @@ func (w *Web) blob(rw http.ResponseWriter, r *http.Request, raw bool) { | |||
| 232 | 232 | preview := markdown && !truncated && r.URL.Query().Get("preview") == "1" | |
| 233 | 233 | var rendered template.HTML | |
| 234 | 234 | if preview { | |
| 235 | rendered = w.renderMarkdown(m.Name, content) | ||
| 235 | // The document knows where it lives, so a relative link in it can be | ||
| 236 | // resolved against its directory instead of the URL it is being read at. | ||
| 237 | rendered = w.renderTreeMarkdown(treeDoc{Repo: m.Name, Ref: ref, Path: p}, content) | ||
| 236 | 238 | } | |
| 237 | 239 | full := !htmxRequest(r) | |
| 238 | 240 | view := w.codeShell(r, m, ref, commit, p, full) | |