From a8f7c066e8d97120ae4e12963e3c9acc8b8906c2 Mon Sep 17 00:00:00 2001 From: Tyler Bui-Palsulich <26876514+tbpg@users.noreply.github.com> Date: Mon, 1 Nov 2021 12:26:42 -0400 Subject: [PATCH] fix(internal/godocfx): replace * with HTML code (#5049) Sometimes, the DocFX Markdown interpreter interprets * as . --- internal/godocfx/parse.go | 6 +++++- internal/godocfx/testdata/golden/index.yml | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/godocfx/parse.go b/internal/godocfx/parse.go index 067208c91b8..56bdede75ab 100644 --- a/internal/godocfx/parse.go +++ b/internal/godocfx/parse.go @@ -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 . + result := string(bytes.ReplaceAll(mdBuf.Bytes(), []byte("*"), []byte("*"))) + + return result } func hasPrefix(s string, prefixes []string) bool { diff --git a/internal/godocfx/testdata/golden/index.yml b/internal/godocfx/testdata/golden/index.yml index b5cc89b1333..47c9a91fe83 100644 --- a/internal/godocfx/testdata/golden/index.yml +++ b/internal/godocfx/testdata/golden/index.yml @@ -91,7 +91,7 @@ items: client are often of the type googleapi.Error.\nThese errors can be introspected for more information by type asserting to the richer googleapi.Error type. For example:

\n
if
-    e, ok := err.(*googleapi.Error); ok {\n\t  if e.Code == 409 { ... }\n}\n
" + e, ok := err.(*googleapi.Error); ok {\n\t if e.Code == 409 { ... }\n}\n" type: package langs: - go