A link like [[My Article]] links to My+Article.md where it rather should link to My-Article.md. The Sidebar links in the above copy of the microsoft/vscode-wiki are a good example.
Looks like the relevant wiki template file is templates/repo/wiki/view.tmpl on line 88, which contains:
{{.sidebarContent | Str2html}}
Str2html is a Go library imported by helper.go that turns markdown into HTML. It is unlikely the links are being improperly rendered by Str2html.
The sidebarContent variable is loaded and set in wiki.go.
This loads the sidebar content from wikiContentsByName() (later in the same wiki.go file).
It renders the final sidebar content by calling markdown.RenderWiki(), which just calls markup.RenderWiki in markup.go. This, in turn, calls a couple of layers of render functions, all in markup.go, until we get to the render() function in markup.go, which contains the culprit line:
func render(parser Parser, rawBytes []byte, urlPrefix string, metas map[string]string, isWiki bool) []byte {
urlPrefix = strings.Replace(urlPrefix, " ", "+", -1) /* <----- O NOES !!!!!! */
result := parser.Render(rawBytes, urlPrefix, metas, isWiki)
result = PostProcess(result, urlPrefix, metas, isWiki)
return SanitizeBytes(result)
}
@charlesreid1 you are awesome. Thanks for the detailed explanation, too!
Most helpful comment
Looks like the relevant wiki template file is templates/repo/wiki/view.tmpl on line 88, which contains:
Str2html is a Go library imported by helper.go that turns markdown into HTML. It is unlikely the links are being improperly rendered by Str2html.
The sidebarContent variable is loaded and set in wiki.go.
This loads the sidebar content from wikiContentsByName() (later in the same wiki.go file).
It renders the final sidebar content by calling markdown.RenderWiki(), which just calls markup.RenderWiki in markup.go. This, in turn, calls a couple of layers of render functions, all in markup.go, until we get to the render() function in markup.go, which contains the culprit line: