Source links in docs generated locally

How can I get valid source code links in html files generated by crystal docs when working locally ?
I tried options --source-url-pattern=file:///home... and --source-refname=<commit|tag> without great results.

crystal docs --source-url-pattern=file:///path/to/project/%{path} --source-refname=foobar should do it.

You have to specify --source-refname but the value actually doesn’t matter (unless you use %{refname} in the pattern).
refname can also be determined automatically if you are in a git repository, but this is only enabled when the working directory is clean.

1 Like