Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure multiple markdown tables are rendered #62

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions writer/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ func (t TableWriter) Write(writer io.Writer) error {
table.AppendBulk(tableString)

if t.mdEnabled {
// Adding a println to break up the tables in md mode
fmt.Println()
// Without a line break separating each table, a single malformed markdown table is printed.
// Printing an empty newline ensures distinct, separate tables are rendered.
fmt.Fprint(writer, tablewriter.NEWLINE)

table.SetBorders(tablewriter.Border{Left: true, Top: false, Right: true, Bottom: false})
table.SetCenterSeparator("|")
} else {
Expand All @@ -77,7 +79,6 @@ func (t TableWriter) Write(writer io.Writer) error {
}

func NewTableWriter(changes map[string]terraformstate.ResourceChanges, outputChanges map[string][]string, mdEnabled bool) Writer {

return TableWriter{
changes: changes,
mdEnabled: mdEnabled,
Expand Down