Skip to content

Commit

Permalink
fix(internal/godocfx): replace * with HTML code (#5049)
Browse files Browse the repository at this point in the history
Sometimes, the DocFX Markdown interpreter interprets * as <em>.
  • Loading branch information
tbpg authored Nov 1, 2021
1 parent 6d07eca commit a8f7c06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion internal/godocfx/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,11 @@ func toHTML(s string) string {
panic(err)
}

return mdBuf.String()
// Replace * with &#42; to avoid confusing the DocFX Markdown processor,
// which sometimes interprets * as <em>.
result := string(bytes.ReplaceAll(mdBuf.Bytes(), []byte("*"), []byte("&#42;")))

return result
}

func hasPrefix(s string, prefixes []string) bool {
Expand Down
2 changes: 1 addition & 1 deletion internal/godocfx/testdata/golden/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ items:
client are often of the type <a href=\"https://godoc.org/google.golang.org/api/googleapi#Error\"><code>googleapi.Error</code></a>.\nThese
errors can be introspected for more information by type asserting to the richer
<code>googleapi.Error</code> type. For example:</p>\n<pre class=\"prettyprint\"><code>if
e, ok := err.(*googleapi.Error); ok {\n\t if e.Code == 409 { ... }\n}\n</code></pre>"
e, ok := err.(&#42;googleapi.Error); ok {\n\t if e.Code == 409 { ... }\n}\n</code></pre>"
type: package
langs:
- go
Expand Down

0 comments on commit a8f7c06

Please sign in to comment.