Skip to content

Commit

Permalink
fix table inheriting previous columns
Browse files Browse the repository at this point in the history
- FIXED: Subsequent tables inheriting first table's column count
  • Loading branch information
ttscoff committed Nov 27, 2023
1 parent d12a2ef commit 7f847ee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/mdless/console.rb
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,15 @@ def table_header_row
end

def table(header, body)
@header_row = []
formatted = CLIMarkdown::MDTableCleanup.new([
"#{header}",
table_header_row,
"|\n",
"#{body}\n\n"
].join(''))
res = formatted.to_md
"#{color_table(res)}\n"
"#{color_table(res)}\n\n"
# res
end

Expand Down
7 changes: 7 additions & 0 deletions test/table.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,10 @@ This is a nifty little table
| an empty row |
| this | should | benefit | all humanity|
| where would | I be | without | you? |

Here's another table with fewer columns

| Key | Value |
|:----|:------|
|name |action |
|other| row |

0 comments on commit 7f847ee

Please sign in to comment.