Monorepo for Tangled tangled.org

proposal: markdown: writing a commit hash inside a markdown comment within a repo should create a link #382

open opened by samanthanguyen.me

I want to be able to link to various commits and have them rendered nicely instead of showing a full URL.

proposal change#

Typing a git commit hash should be parsed within the markdown text.

proposal implementation#

Similar to how there is already a markdown extension at appview/pages/markup/extension/atlink.go, we could create another extension like appview/pages/markup/extension/commit_hash.go.

Could use a regular expression to match for commit hash (SHA1 hash), accepting a short version and long version. For every match, call Repository.ResolveRevision(), passing in the current repository context and the possible match. If it resolves, convert to a rendered link formatted inline with <code>. If it doesn't, render the text as normal.

boltless.me

already working on it! will drop a PR soon

samanthanguyen.me (author)

thanks!

boltless.me edited

Though we cannot just support abcd style commit referencing. The appview needs to fetch knot to check commits existence so it is hard to check them on render.

For now we are going to render /commit/<sha> links into inline code with short hash.

Smart commit referencing will be possible after appview has its own local knot cache.

samanthanguyen.me (author) edited

No worries, having any sort of supported syntax at all would still be great. :) I figured it'd probably be harder than I imagined since I'm still learning about how the codebase works, my proposal impl was something off the top of my head. good to know!

sign up or login to add to the discussion
Labels

None yet.

area

None yet.

assignee

None yet.

Participants 2
AT URI
at://did:plc:smd2mvg2dao4rqnnz6qexdov/sh.tangled.repo.issue/3mctiz2octx22