Skip to content
This repository was archived by the owner on Apr 1, 2024. It is now read-only.

Commit e009d7c

Browse files
authored
Merge pull request #40 from skanehira/fix-table-distorted
fix: The table display will become distorted. #39
2 parents 664bdd8 + d058088 commit e009d7c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

internal/markdown/mutations.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66

77
"github.com/Code-Hex/gqldoc/internal/introspection"
88
"github.com/pkg/errors"
9+
"strings"
910
)
1011

1112
//go:embed mutations.md
@@ -74,9 +75,14 @@ func (m *Config) renderMutation(s *introspection.Schema) error {
7475
if err != nil {
7576
return errors.Wrapf(err, "return type %q has caused error", rf.Type.UnderlyingName())
7677
}
78+
// NOTE: If description has newline and its in the table, we need to replace newline to <br>
79+
desc := renderHTML(rf.Description)
80+
if desc != "" {
81+
desc = strings.Replace(desc, "\n", "<br>", -1)
82+
}
7783
rfs = append(rfs, &MutationFieldReturn{
7884
Name: rf.Name,
79-
Description: renderHTML(rf.Description),
85+
Description: desc,
8086
Type: rf.Type.String(),
8187
TypeLink: link,
8288
})

0 commit comments

Comments
 (0)