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

Commit

Permalink
Merge pull request #40 from skanehira/fix-table-distorted
Browse files Browse the repository at this point in the history
fix: The table display will become distorted. #39
  • Loading branch information
Code-Hex committed Apr 4, 2023
2 parents 664bdd8 + d058088 commit e009d7c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/markdown/mutations.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/Code-Hex/gqldoc/internal/introspection"
"github.com/pkg/errors"
"strings"
)

//go:embed mutations.md
Expand Down Expand Up @@ -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 <br>
desc := renderHTML(rf.Description)
if desc != "" {
desc = strings.Replace(desc, "\n", "<br>", -1)
}
rfs = append(rfs, &MutationFieldReturn{
Name: rf.Name,
Description: renderHTML(rf.Description),
Description: desc,
Type: rf.Type.String(),
TypeLink: link,
})
Expand Down

0 comments on commit e009d7c

Please sign in to comment.