From 1025c0e7bd7937f02b842da704e23aa3f4e7b06b Mon Sep 17 00:00:00 2001 From: James Date: Mon, 29 Oct 2018 15:59:30 -0500 Subject: [PATCH 1/2] Fixed deprecated (see: https://www.w3.org/TR/html4/present/graphics.html#h-15.1.2) align property on tables. Now uses inline CSS. --- html.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html.go b/html.go index 284c8718..ab586fdc 100644 --- a/html.go +++ b/html.go @@ -786,7 +786,7 @@ func (r *HTMLRenderer) RenderNode(w io.Writer, node *Node, entering bool) WalkSt if entering { align := cellAlignment(node.Align) if align != "" { - attrs = append(attrs, fmt.Sprintf(`align="%s"`, align)) + attrs = append(attrs, fmt.Sprintf(`style="text-align: %s;"`, align)) } if node.Prev == nil { r.cr(w) From d5f47b6f6abe02d199dd7b687568040f7daa0ac9 Mon Sep 17 00:00:00 2001 From: James Date: Mon, 29 Oct 2018 16:33:49 -0500 Subject: [PATCH 2/2] Updated test so that it checks for the new style of alignment using CSS instead of the deprecated 'align' attribute --- block_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/block_test.go b/block_test.go index 326c3110..ecf42d2c 100644 --- a/block_test.go +++ b/block_test.go @@ -1282,10 +1282,10 @@ func TestTable(t *testing.T) { "\n\nd\ne\nf\n\n\n\n", "a|b|c|d\n:--|--:|:-:|---\ne|f|g|h\n", - "\n\n\n\n\n" + - "\n\n\n\n\n" + - "\n\n\n\n" + - "\n\n\n\n
abcd
efgh
\n", + "\n\n\n\n\n" + + "\n\n\n\n\n" + + "\n\n\n\n" + + "\n\n\n\n
abcd
efgh
\n", "a|b|c\n---|---|---\n", "\n\n\n\n\n\n\n\n\n\n\n
abc
\n",