Skip to content

Commit 3cfb20c

Browse files
authored
Merge pull request #366 from CodeGenerator/feature/fix_github_format
Fix multiline support for github format
2 parents b23f8f9 + 9dedd45 commit 3cfb20c

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

tabulate/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,7 @@ def escape_empty(val):
737737
"pretty": "pretty",
738738
"psql": "psql",
739739
"rst": "rst",
740+
"github": "github",
740741
"outline": "outline",
741742
"simple_outline": "simple_outline",
742743
"rounded_outline": "rounded_outline",

test/test_output.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,23 @@ def test_github():
509509
assert_equal(expected, result)
510510

511511

512+
def test_github_multiline():
513+
"Output: github with multiline cells with headers"
514+
table = [[2, "foo\nbar"]]
515+
headers = ("more\nspam eggs", "more spam\n& eggs")
516+
expected = "\n".join(
517+
[
518+
"| more | more spam |",
519+
"| spam eggs | & eggs |",
520+
"|-------------|-------------|",
521+
"| 2 | foo |",
522+
"| | bar |",
523+
]
524+
)
525+
result = tabulate(table, headers, tablefmt="github")
526+
assert_equal(expected, result)
527+
528+
512529
def test_grid():
513530
"Output: grid with headers"
514531
expected = "\n".join(

0 commit comments

Comments
 (0)