Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect & fix backwards markdown links (of the form (foo)[bar]) #22036

Merged
merged 1 commit into from
Mar 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions cluster/cloudimages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ Advantages of a harmonized image:
## bootstrap-vz

Currently images are built using
(bootstrap-vz)[https://github.com/andsens/bootstrap-vz], because this is
[bootstrap-vz](https://github.com/andsens/bootstrap-vz), because this is
default builder for the official Debian images, and because it supports
multiple clouds including AWS, Azure & GCE. It also supports KVM, which should
support OpenStack.

## Building an image

A go program/script to build images in (in
progress)[https://github.com/kubernetes/contrib/pull/486], in the contrib
A go program/script to build images in
[in progress](https://github.com/kubernetes/contrib/pull/486), in the contrib
project.


Expand Down
12 changes: 11 additions & 1 deletion cmd/mungedocs/links.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import (
var (
// Finds markdown links of the form [foo](bar "alt-text").
linkRE = regexp.MustCompile(`\[([^]]*)\]\(([^)]*)\)`)
// Finds markdown link typos of the form (foo)[bar]
badLinkRE = regexp.MustCompile(`\([^]()]*\)\[[^]()]*\]`)
// Splits the link target into link target and alt-text.
altTextRE = regexp.MustCompile(`([^)]*)( ".*")`)
)
Expand Down Expand Up @@ -125,7 +127,15 @@ func updateLinks(filePath string, mlines mungeLines) (mungeLines, error) {
allErrs := []string{}

for lineNum, mline := range mlines {
if mline.preformatted || !mline.link {
if mline.preformatted {
out = append(out, mline)
continue
}
if badMatch := badLinkRE.FindString(mline.data); badMatch != "" {
allErrs = append(allErrs,
fmt.Sprintf("On line %d: found backwards markdown link %q", lineNum, badMatch))
}
if !mline.link {
out = append(out, mline)
continue
}
Expand Down
2 changes: 1 addition & 1 deletion examples/spark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ $ kubectl port-forward zeppelin-controller-ja09s 8080:8080
```

This forwards `localhost` 8080 to container port 8080. You can then find
Zeppelin at (https://localhost:8080/)[https://localhost:8080/].
Zeppelin at [https://localhost:8080/](https://localhost:8080/).

Create a "New Notebook". In there, type:

Expand Down