Skip to content

Commit a8f7c06

Browse files
authored
fix(internal/godocfx): replace * with HTML code (#5049)
Sometimes, the DocFX Markdown interpreter interprets * as <em>.
1 parent 6d07eca commit a8f7c06

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

internal/godocfx/parse.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,11 @@ func toHTML(s string) string {
625625
panic(err)
626626
}
627627

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

631635
func hasPrefix(s string, prefixes []string) bool {

internal/godocfx/testdata/golden/index.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ items:
9191
client are often of the type <a href=\"https://godoc.org/google.golang.org/api/googleapi#Error\"><code>googleapi.Error</code></a>.\nThese
9292
errors can be introspected for more information by type asserting to the richer
9393
<code>googleapi.Error</code> type. For example:</p>\n<pre class=\"prettyprint\"><code>if
94-
e, ok := err.(*googleapi.Error); ok {\n\t if e.Code == 409 { ... }\n}\n</code></pre>"
94+
e, ok := err.(&#42;googleapi.Error); ok {\n\t if e.Code == 409 { ... }\n}\n</code></pre>"
9595
type: package
9696
langs:
9797
- go

0 commit comments

Comments
 (0)