Fix Markdown formatting of narrow table columns (#1430)

This commit is contained in:
Jonatan Kłosko 2022-09-22 21:10:51 +02:00 committed by GitHub
parent 5ade7f97e1
commit 12f77daa68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View file

@ -353,6 +353,7 @@ defmodule Livebook.LiveMarkdown.MarkdownHelpers do
cells
|> Enum.map(&IO.iodata_length/1)
|> Enum.max()
|> max(3)
end)
end

View file

@ -212,6 +212,16 @@ defmodule Livebook.LiveMarkdown.MarkdownHelpersTest do
assert markdown == reformat(markdown)
end
test "table with narrow column" do
markdown = """
| x | y | x and y |
| :-: | --- | ------- |
| 1 | 1 | 0 |\
"""
assert markdown == reformat(markdown)
end
test "basic unordered list" do
markdown = """
* Olafur Arnalds