diff --git a/devtools/hackdoc/main.go b/devtools/hackdoc/main.go index aae850f7..e460721a 100644 --- a/devtools/hackdoc/main.go +++ b/devtools/hackdoc/main.go @@ -205,7 +205,7 @@ func (r *request) handlePageAuto(dirpath string) { } if file { - http.Redirect(r.w, r.r, "/"+fpath, 302) + http.Redirect(r.w, r.r, "/"+fpath+"?ref="+r.ref, 302) return } } diff --git a/devtools/hackdoc/markdown.go b/devtools/hackdoc/markdown.go index 06e2c6e2..14ffe45e 100644 --- a/devtools/hackdoc/markdown.go +++ b/devtools/hackdoc/markdown.go @@ -27,7 +27,7 @@ func renderMarkdown(input []byte, ref string) []byte { r.RenderHeader(&buf, ast) buf.Write([]byte(`
`)) ast.Walk(func(node *blackfriday.Node, entering bool) blackfriday.WalkStatus { - if ref != "" && entering && node.Type == blackfriday.Link { + if ref != "" && entering && node.Type == blackfriday.Link || node.Type == blackfriday.Image { dest := string(node.Destination) u, err := url.Parse(dest) if err == nil && !u.IsAbs() {