From d058088bd078456358903503311b47e9ab2fd8e7 Mon Sep 17 00:00:00 2001 From: skanehira Date: Tue, 4 Apr 2023 15:48:07 +0900 Subject: [PATCH] fix: The table display will become distorted. #39 --- internal/markdown/mutations.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/markdown/mutations.go b/internal/markdown/mutations.go index 8a554f924cea3..eca3fc727cf79 100644 --- a/internal/markdown/mutations.go +++ b/internal/markdown/mutations.go @@ -6,6 +6,7 @@ import ( "github.com/Code-Hex/gqldoc/internal/introspection" "github.com/pkg/errors" + "strings" ) //go:embed mutations.md @@ -74,9 +75,14 @@ func (m *Config) renderMutation(s *introspection.Schema) error { if err != nil { return errors.Wrapf(err, "return type %q has caused error", rf.Type.UnderlyingName()) } + // NOTE: If description has newline and its in the table, we need to replace newline to
+ desc := renderHTML(rf.Description) + if desc != "" { + desc = strings.Replace(desc, "\n", "
", -1) + } rfs = append(rfs, &MutationFieldReturn{ Name: rf.Name, - Description: renderHTML(rf.Description), + Description: desc, Type: rf.Type.String(), TypeLink: link, })