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

fix(internal/godocfx): replace * with HTML code #5049

Merged
merged 2 commits into from Nov 1, 2021
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: 5 additions & 1 deletion internal/godocfx/parse.go
Expand Up @@ -625,7 +625,11 @@ func toHTML(s string) string {
panic(err)
}

return mdBuf.String()
// Replace * with * 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
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