mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-09-10 15:04:25 +08:00
Fix Markdown formatting of narrow table columns (#1430)
This commit is contained in:
parent
5ade7f97e1
commit
12f77daa68
2 changed files with 13 additions and 2 deletions
|
@ -353,6 +353,7 @@ defmodule Livebook.LiveMarkdown.MarkdownHelpers do
|
|||
cells
|
||||
|> Enum.map(&IO.iodata_length/1)
|
||||
|> Enum.max()
|
||||
|> max(3)
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
|
@ -205,8 +205,18 @@ defmodule Livebook.LiveMarkdown.MarkdownHelpersTest do
|
|||
|
||||
test "table without header" do
|
||||
markdown = """
|
||||
| Texas | TX | Austin |
|
||||
| Maine | ME | Augusta |\
|
||||
| Texas | TX | Austin |
|
||||
| Maine | ME | Augusta |\
|
||||
"""
|
||||
|
||||
assert markdown == reformat(markdown)
|
||||
end
|
||||
|
||||
test "table with narrow column" do
|
||||
markdown = """
|
||||
| x | y | x and y |
|
||||
| :-: | --- | ------- |
|
||||
| 1 | 1 | 0 |\
|
||||
"""
|
||||
|
||||
assert markdown == reformat(markdown)
|
||||
|
|
Loading…
Add table
Reference in a new issue