Skip to content

Commit

Permalink
docgen: fix links with trailing dots (#3399)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreimatei authored May 31, 2023
1 parent 6a56d0e commit 5c711f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Documentation/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ Print contents of CPU registers.

regs [-a]

Argument -a shows more registers. Individual registers can also be displayed by 'print' and 'display'. See [Documentation/cli/expr.md.](//github.com/go-delve/delve/tree/master/Documentation/cli/expr.md.)
Argument -a shows more registers. Individual registers can also be displayed by 'print' and 'display'. See [Documentation/cli/expr.md](//github.com/go-delve/delve/tree/master/Documentation/cli/expr.md).


## restart
Expand Down
4 changes: 4 additions & 0 deletions pkg/terminal/docgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ func replaceDocPath(s string) string {
break
}
}
// If we captured a trailing dot, backtrack.
if s[end-1] == '.' {
end--
}

text := s[start:end]
s = s[:start] + fmt.Sprintf("[%s](//github.com/go-delve/delve/tree/master/%s)", text, text) + s[end:]
Expand Down

0 comments on commit 5c711f8

Please sign in to comment.