Skip to content

Commit

Permalink
Fix local path regex
Browse files Browse the repository at this point in the history
Fixes #79
  • Loading branch information
posener committed Aug 15, 2019
1 parent b8f1d5f commit c390545
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/markdown/comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const (
urlRx = protoPart + `://` + hostPart + pathPart

// Regexp for local paths
localRx = `\.\/[^\s]+`
localRx = `\.\/[a-zA-Z0-9_@\-\.\/]*`
)

var matchRx = regexp.MustCompile(`(` + urlTitle + `((` + urlRx + `)|(` + localRx + `)))|(` + identRx + `)`)
Expand Down
1 change: 1 addition & 0 deletions testdata/pkg1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ A local link should just start with period and slash: [./internal](./internal),
A web page link should just be written as is: [https://goreadme.herokuapp.com](https://goreadme.herokuapp.com), and with path: [https://goreadme.herokuapp.com/projects](https://goreadme.herokuapp.com/projects).
A url can also have a [title](http://example.org).
A local path can also have a [title](./pkg.go).
A local path in inline code `go test [./](./)`.

#### Another Section Header

Expand Down
1 change: 1 addition & 0 deletions testdata/pkg1/pkg1.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// A web page link should just be written as is: https://goreadme.herokuapp.com, and with path: https://goreadme.herokuapp.com/projects.
// A url can also have a (title) http://example.org.
// A local path can also have a (title) ./pkg.go.
// A local path in inline code `go test ./`.
//
// Another Section Header
//
Expand Down

0 comments on commit c390545

Please sign in to comment.