Repository: terraform-docs/terraform-docs
Pull request #787 (2024-07-05 18:27:24)

feat: Replace <br> with <br /> for markdown syntax


### Description of your changes
 <br /> provides additional support for XHTML without breaking compatibility with HTML. This can be useful when trying to publish documentation generated by terraform-docs to XHTML based solutions

I have:

- [/] Read and followed terraform-docs' [contribution process].
- [/] All tests pass when I run `make test`.

### How has this code been tested

<!--
Before reviewers can be confident in the correctness of this pull request, it
needs to tested and shown to be correct. Briefly describe the testing that has
already been done or which is planned for this change.
-->

Generate a terraform-docs markdown and check the output of the code



Patch:
diff --git a/docs/reference/markdown-table.md b/docs/reference/markdown-table.md
index 6c6faad..64b4ce7 100644
--- a/docs/reference/markdown-table.md
+++ b/docs/reference/markdown-table.md
@@ -148,15 +148,15 @@ generates the following output:
     | <a name="input_bool-2"></a> [bool-2](#input\_bool-2) | It's bool number two. | `bool` | `false` | no |
     | <a name="input_bool-3"></a> [bool-3](#input\_bool-3) | n/a | `bool` | `true` | no |
     | <a name="input_bool_default_false"></a> [bool\_default\_false](#input\_bool\_default\_false) | n/a | `bool` | `false` | no |
-    | <a name="input_input-with-code-block"></a> [input-with-code-block](#input\_input-with-code-block) | This is a complicated one. We need a newline.<br>And an example in a code block<pre>default     = [<br>  "machine rack01:neptune"<br>]</pre> | `list` | <pre>[<br>  "name rack:location"<br>]</pre> | no |
+    | <a name="input_input-with-code-block"></a> [input-with-code-block](#input\_input-with-code-block) | This is a complicated one. We need a newline.<br/>And an example in a code block<pre>default     = [<br/>  "machine rack01:neptune"<br/>]</pre> | `list` | <pre>[<br/>  "name rack:location"<br/>]</pre> | no |
     | <a name="input_input-with-pipe"></a> [input-with-pipe](#input\_input-with-pipe) | It includes v1 \| v2 \| v3 | `string` | `"v1"` | no |
     | <a name="input_input_with_underscores"></a> [input\_with\_underscores](#input\_input\_with\_underscores) | A variable with underscores. | `any` | n/a | yes |
-    | <a name="input_list-1"></a> [list-1](#input\_list-1) | It's list number one. | `list` | <pre>[<br>  "a",<br>  "b",<br>  "c"<br>]</pre> | no |
+    | <a name="input_list-1"></a> [list-1](#input\_list-1) | It's list number one. | `list` | <pre>[<br/>  "a",<br/>  "b",<br/>  "c"<br/>]</pre> | no |
     | <a name="input_list-2"></a> [list-2](#input\_list-2) | It's list number two. | `list` | n/a | yes |
     | <a name="input_list-3"></a> [list-3](#input\_list-3) | n/a | `list` | `[]` | no |
     | <a name="input_list_default_empty"></a> [list\_default\_empty](#input\_list\_default\_empty) | n/a | `list(string)` | `[]` | no |
-    | <a name="input_long_type"></a> [long\_type](#input\_long\_type) | This description is itself markdown.<br><br>It spans over multiple lines. | <pre>object({<br>    name = string,<br>    foo  = object({ foo = string, bar = string }),<br>    bar  = object({ foo = string, bar = string }),<br>    fizz = list(string),<br>    buzz = list(string)<br>  })</pre> | <pre>{<br>  "bar": {<br>    "bar": "bar",<br>    "foo": "bar"<br>  },<br>  "buzz": [<br>    "fizz",<br>    "buzz"<br>  ],<br>  "fizz": [],<br>  "foo": {<br>    "bar": "foo",<br>    "foo": "foo"<br>  },<br>  "name": "hello"<br>}</pre> | no |
-    | <a name="input_map-1"></a> [map-1](#input\_map-1) | It's map number one. | `map` | <pre>{<br>  "a": 1,<br>  "b": 2,<br>  "c": 3<br>}</pre> | no |
+    | <a name="input_long_type"></a> [long\_type](#input\_long\_type) | This description is itself markdown.<br/><br/>It spans over multiple lines. | <pre>object({<br/>    name = string,<br/>    foo  = object({ foo = string, bar = string }),<br/>    bar  = object({ foo = string, bar = string }),<br/>    fizz = list(string),<br/>    buzz = list(string)<br/>  })</pre> | <pre>{<br/>  "bar": {<br/>    "bar": "bar",<br/>    "foo": "bar"<br/>  },<br/>  "buzz": [<br/>    "fizz",<br/>    "buzz"<br/>  ],<br/>  "fizz": [],<br/>  "foo": {<br/>    "bar": "foo",<br/>    "foo": "foo"<br/>  },<br/>  "name": "hello"<br/>}</pre> | no |
+    | <a name="input_map-1"></a> [map-1](#input\_map-1) | It's map number one. | `map` | <pre>{<br/>  "a": 1,<br/>  "b": 2,<br/>  "c": 3<br/>}</pre> | no |
     | <a name="input_map-2"></a> [map-2](#input\_map-2) | It's map number two. | `map` | n/a | yes |
     | <a name="input_map-3"></a> [map-3](#input\_map-3) | n/a | `map` | `{}` | no |
     | <a name="input_no-escape-default-value"></a> [no-escape-default-value](#input\_no-escape-default-value) | The description contains `something_with_underscore`. Defaults to 'VALUE\_WITH\_UNDERSCORE'. | `string` | `"VALUE_WITH_UNDERSCORE"` | no |
diff --git a/template/sanitizer.go b/template/sanitizer.go
index bf020d3..029ee98 100644
--- a/template/sanitizer.go
+++ b/template/sanitizer.go
@@ -114,7 +114,7 @@ func SanitizeMarkdownTable(s string, escape bool, html bool) string {
 			return segment
 		},
 		func(segment string, first bool, last bool) string {
-			linebreak := "<br>"
+			linebreak := "<br/>"
 			codestart := "<pre>"
 			codeend := "</pre>"
 
@@ -189,11 +189,11 @@ func ConvertMultiLineText(s string, isTable bool, isHeader bool, showHTML bool)
 		return s
 	}
 
-	// representation of line break. <br> if showHTML is true, <space> if false.
+	// representation of line break. <br/> if showHTML is true, <space> if false.
 	linebreak := " "
 
 	if showHTML {
-		linebreak = "<br>"
+		linebreak = "<br/>"
 	}
 
 	// Convert space-space-newline to 'linebreak'.


Test patch:
diff --git a/format/testdata/markdown/table-Base.golden b/format/testdata/markdown/table-Base.golden
index 21ef339..24333ee 100644
--- a/format/testdata/markdown/table-Base.golden
+++ b/format/testdata/markdown/table-Base.golden
@@ -92,14 +92,14 @@ followed by another line of text.
 | number-1 | It's number number one. | `number` | `42` |
 | map-3 | n/a | `map` | `{}` |
 | map-2 | It's map number two. | `map` | n/a |
-| map-1 | It's map number one. | `map` | <pre>{<br>  "a": 1,<br>  "b": 2,<br>  "c": 3<br>}</pre> |
+| map-1 | It's map number one. | `map` | <pre>{<br/>  "a": 1,<br/>  "b": 2,<br/>  "c": 3<br/>}</pre> |
 | list-3 | n/a | `list` | `[]` |
 | list-2 | It's list number two. | `list` | n/a |
-| list-1 | It's list number one. | `list` | <pre>[<br>  "a",<br>  "b",<br>  "c"<br>]</pre> |
+| list-1 | It's list number one. | `list` | <pre>[<br/>  "a",<br/>  "b",<br/>  "c"<br/>]</pre> |
 | input_with_underscores | A variable with underscores. | `any` | n/a |
 | input-with-pipe | It includes v1 \| v2 \| v3 | `string` | `"v1"` |
-| input-with-code-block | This is a complicated one. We need a newline.<br>And an example in a code block<pre>default     = [<br>  "machine rack01:neptune"<br>]</pre> | `list` | <pre>[<br>  "name rack:location"<br>]</pre> |
-| long_type | This description is itself markdown.<br><br>It spans over multiple lines. | <pre>object({<br>    name = string,<br>    foo  = object({ foo = string, bar = string }),<br>    bar  = object({ foo = string, bar = string }),<br>    fizz = list(string),<br>    buzz = list(string)<br>  })</pre> | <pre>{<br>  "bar": {<br>    "bar": "bar",<br>    "foo": "bar"<br>  },<br>  "buzz": [<br>    "fizz",<br>    "buzz"<br>  ],<br>  "fizz": [],<br>  "foo": {<br>    "bar": "foo",<br>    "foo": "foo"<br>  },<br>  "name": "hello"<br>}</pre> |
+| input-with-code-block | This is a complicated one. We need a newline.<br/>And an example in a code block<pre>default     = [<br/>  "machine rack01:neptune"<br/>]</pre> | `list` | <pre>[<br/>  "name rack:location"<br/>]</pre> |
+| long_type | This description is itself markdown.<br/><br/>It spans over multiple lines. | <pre>object({<br/>    name = string,<br/>    foo  = object({ foo = string, bar = string }),<br/>    bar  = object({ foo = string, bar = string }),<br/>    fizz = list(string),<br/>    buzz = list(string)<br/>  })</pre> | <pre>{<br/>  "bar": {<br/>    "bar": "bar",<br/>    "foo": "bar"<br/>  },<br/>  "buzz": [<br/>    "fizz",<br/>    "buzz"<br/>  ],<br/>  "fizz": [],<br/>  "foo": {<br/>    "bar": "foo",<br/>    "foo": "foo"<br/>  },<br/>  "name": "hello"<br/>}</pre> |
 | no-escape-default-value | The description contains `something_with_underscore`. Defaults to 'VALUE_WITH_UNDERSCORE'. | `string` | `"VALUE_WITH_UNDERSCORE"` |
 | with-url | The description contains url. https://www.domain.com/foo/bar_baz.html | `string` | `""` |
 | string_default_empty | n/a | `string` | `""` |
diff --git a/format/testdata/markdown/table-EscapeCharacters.golden b/format/testdata/markdown/table-EscapeCharacters.golden
index bb82f74..b8e6b01 100644
--- a/format/testdata/markdown/table-EscapeCharacters.golden
+++ b/format/testdata/markdown/table-EscapeCharacters.golden
@@ -92,14 +92,14 @@ followed by another line of text.
 | number-1 | It's number number one. | `number` | `42` |
 | map-3 | n/a | `map` | `{}` |
 | map-2 | It's map number two. | `map` | n/a |
-| map-1 | It's map number one. | `map` | <pre>{<br>  "a": 1,<br>  "b": 2,<br>  "c": 3<br>}</pre> |
+| map-1 | It's map number one. | `map` | <pre>{<br/>  "a": 1,<br/>  "b": 2,<br/>  "c": 3<br/>}</pre> |
 | list-3 | n/a | `list` | `[]` |
 | list-2 | It's list number two. | `list` | n/a |
-| list-1 | It's list number one. | `list` | <pre>[<br>  "a",<br>  "b",<br>  "c"<br>]</pre> |
+| list-1 | It's list number one. | `list` | <pre>[<br/>  "a",<br/>  "b",<br/>  "c"<br/>]</pre> |
 | input\_with\_underscores | A variable with underscores. | `any` | n/a |
 | input-with-pipe | It includes v1 \| v2 \| v3 | `string` | `"v1"` |
-| input-with-code-block | This is a complicated one. We need a newline.<br>And an example in a code block<pre>default     = [<br>  "machine rack01:neptune"<br>]</pre> | `list` | <pre>[<br>  "name rack:location"<br>]</pre> |
-| long\_type | This description is itself markdown.<br><br>It spans over multiple lines. | <pre>object({<br>    name = string,<br>    foo  = object({ foo = string, bar = string }),<br>    bar  = object({ foo = string, bar = string }),<br>    fizz = list(string),<br>    buzz = list(string)<br>  })</pre> | <pre>{<br>  "bar": {<br>    "bar": "bar",<br>    "foo": "bar"<br>  },<br>  "buzz": [<br>    "fizz",<br>    "buzz"<br>  ],<br>  "fizz": [],<br>  "foo": {<br>    "bar": "foo",<br>    "foo": "foo"<br>  },<br>  "name": "hello"<br>}</pre> |
+| input-with-code-block | This is a complicated one. We need a newline.<br/>And an example in a code block<pre>default     = [<br/>  "machine rack01:neptune"<br/>]</pre> | `list` | <pre>[<br/>  "name rack:location"<br/>]</pre> |
+| long\_type | This description is itself markdown.<br/><br/>It spans over multiple lines. | <pre>object({<br/>    name = string,<br/>    foo  = object({ foo = string, bar = string }),<br/>    bar  = object({ foo = string, bar = string }),<br/>    fizz = list(string),<br/>    buzz = list(string)<br/>  })</pre> | <pre>{<br/>  "bar": {<br/>    "bar": "bar",<br/>    "foo": "bar"<br/>  },<br/>  "buzz": [<br/>    "fizz",<br/>    "buzz"<br/>  ],<br/>  "fizz": [],<br/>  "foo": {<br/>    "bar": "foo",<br/>    "foo": "foo"<br/>  },<br/>  "name": "hello"<br/>}</pre> |
 | no-escape-default-value | The description contains `something_with_underscore`. Defaults to 'VALUE\_WITH\_UNDERSCORE'. | `string` | `"VALUE_WITH_UNDERSCORE"` |
 | with-url | The description contains url. https://www.domain.com/foo/bar_baz.html | `string` | `""` |
 | string\_default\_empty | n/a | `string` | `""` |
diff --git a/format/testdata/markdown/table-IndentationOfFour.golden b/format/testdata/markdown/table-IndentationOfFour.golden
index 19c86fd..96e9c4f 100644
--- a/format/testdata/markdown/table-IndentationOfFour.golden
+++ b/format/testdata/markdown/table-IndentationOfFour.golden
@@ -92,14 +92,14 @@ followed by another line of text.
 | number-1 | It's number number one. | `number` | `42` |
 | map-3 | n/a | `map` | `{}` |
 | map-2 | It's map number two. | `map` | n/a |
-| map-1 | It's map number one. | `map` | <pre>{<br>  "a": 1,<br>  "b": 2,<br>  "c": 3<br>}</pre> |
+| map-1 | It's map number one. | `map` | <pre>{<br/>  "a": 1,<br/>  "b": 2,<br/>  "c": 3<br/>}</pre> |
 | list-3 | n/a | `list` | `[]` |
 | list-2 | It's list number two. | `list` | n/a |
-| list-1 | It's list number one. | `list` | <pre>[<br>  "a",<br>  "b",<br>  "c"<br>]</pre> |
+| list-1 | It's list number one. | `list` | <pre>[<br/>  "a",<br/>  "b",<br/>  "c"<br/>]</pre> |
 | input_with_underscores | A variable with underscores. | `any` | n/a |
 | input-with-pipe | It includes v1 \| v2 \| v3 | `string` | `"v1"` |
-| input-with-code-block | This is a complicated one. We need a newline.<br>And an example in a code block<pre>default     = [<br>  "machine rack01:neptune"<br>]</pre> | `list` | <pre>[<br>  "name rack:location"<br>]</pre> |
-| long_type | This description is itself markdown.<br><br>It spans over multiple lines. | <pre>object({<br>    name = string,<br>    foo  = object({ foo = string, bar = string }),<br>    bar  = object({ foo = string, bar = string }),<br>    fizz = list(string),<br>    buzz = list(string)<br>  })</pre> | <pre>{<br>  "bar": {<br>    "bar": "bar",<br>    "foo": "bar"<br>  },<br>  "buzz": [<br>    "fizz",<br>    "buzz"<br>  ],<br>  "fizz": [],<br>  "foo": {<br>    "bar": "foo",<br>    "foo": "foo"<br>  },<br>  "name": "hello"<br>}</pre> |
+| input-with-code-block | This is a complicated one. We need a newline.<br/>And an example in a code block<pre>default     = [<br/>  "machine rack01:neptune"<br/>]</pre> | `list` | <pre>[<br/>  "name rack:location"<br/>]</pre> |
+| long_type | This description is itself markdown.<br/><br/>It spans over multiple lines. | <pre>object({<br/>    name = string,<br/>    foo  = object({ foo = string, bar = string }),<br/>    bar  = object({ foo = string, bar = string }),<br/>    fizz = list(string),<br/>    buzz = list(string)<br/>  })</pre> | <pre>{<br/>  "bar": {<br/>    "bar": "bar",<br/>    "foo": "bar"<br/>  },<br/>  "buzz": [<br/>    "fizz",<br/>    "buzz"<br/>  ],<br/>  "fizz": [],<br/>  "foo": {<br/>    "bar": "foo",<br/>    "foo": "foo"<br/>  },<br/>  "name": "hello"<br/>}</pre> |
 | no-escape-default-value | The description contains `something_with_underscore`. Defaults to 'VALUE_WITH_UNDERSCORE'. | `string` | `"VALUE_WITH_UNDERSCORE"` |
 | with-url | The description contains url. https://www.domain.com/foo/bar_baz.html | `string` | `""` |
 | string_default_empty | n/a | `string` | `""` |
diff --git a/format/testdata/markdown/table-OutputValues.golden b/format/testdata/markdown/table-OutputValues.golden
index 309b85c..b0a25b3 100644
--- a/format/testdata/markdown/table-OutputValues.golden
+++ b/format/testdata/markdown/table-OutputValues.golden
@@ -2,7 +2,7 @@
 
 | Name | Description | Value | Sensitive |
 |------|-------------|-------|:---------:|
-| unquoted | It's unquoted output. | <pre>{<br>  "leon": "cat"<br>}</pre> | no |
-| output-2 | It's output number two. | <pre>[<br>  "jack",<br>  "lola"<br>]</pre> | no |
+| unquoted | It's unquoted output. | <pre>{<br/>  "leon": "cat"<br/>}</pre> | no |
+| output-2 | It's output number two. | <pre>[<br/>  "jack",<br/>  "lola"<br/>]</pre> | no |
 | output-1 | It's output number one. | `1` | no |
 | output-0.12 | terraform 0.12 only | `<sensitive>` | yes |
\ No newline at end of file
diff --git a/format/testdata/markdown/table-OutputValuesNoSensitivity.golden b/format/testdata/markdown/table-OutputValuesNoSensitivity.golden
index 8e7f021..0e6221c 100644
--- a/format/testdata/markdown/table-OutputValuesNoSensitivity.golden
+++ b/format/testdata/markdown/table-OutputValuesNoSensitivity.golden
@@ -2,7 +2,7 @@
 
 | Name | Description | Value |
 |------|-------------|-------|
-| unquoted | It's unquoted output. | <pre>{<br>  "leon": "cat"<br>}</pre> |
-| output-2 | It's output number two. | <pre>[<br>  "jack",<br>  "lola"<br>]</pre> |
+| unquoted | It's unquoted output. | <pre>{<br/>  "leon": "cat"<br/>}</pre> |
+| output-2 | It's output number two. | <pre>[<br/>  "jack",<br/>  "lola"<br/>]</pre> |
 | output-1 | It's output number one. | `1` |
 | output-0.12 | terraform 0.12 only | `<sensitive>` |
\ No newline at end of file
diff --git a/format/testdata/markdown/table-WithAnchor.golden b/format/testdata/markdown/table-WithAnchor.golden
index a1aaacc..6a202b2 100644
--- a/format/testdata/markdown/table-WithAnchor.golden
+++ b/format/testdata/markdown/table-WithAnchor.golden
@@ -92,14 +92,14 @@ followed by another line of text.
 | <a name="input_number-1"></a> [number-1](#input_number-1) | It's number number one. | `number` | `42` |
 | <a name="input_map-3"></a> [map-3](#input_map-3) | n/a | `map` | `{}` |
 | <a name="input_map-2"></a> [map-2](#input_map-2) | It's map number two. | `map` | n/a |
-| <a name="input_map-1"></a> [map-1](#input_map-1) | It's map number one. | `map` | <pre>{<br>  "a": 1,<br>  "b": 2,<br>  "c": 3<br>}</pre> |
+| <a name="input_map-1"></a> [map-1](#input_map-1) | It's map number one. | `map` | <pre>{<br/>  "a": 1,<br/>  "b": 2,<br/>  "c": 3<br/>}</pre> |
 | <a name="input_list-3"></a> [list-3](#input_list-3) | n/a | `list` | `[]` |
 | <a name="input_list-2"></a> [list-2](#input_list-2) | It's list number two. | `list` | n/a |
-| <a name="input_list-1"></a> [list-1](#input_list-1) | It's list number one. | `list` | <pre>[<br>  "a",<br>  "b",<br>  "c"<br>]</pre> |
+| <a name="input_list-1"></a> [list-1](#input_list-1) | It's list number one. | `list` | <pre>[<br/>  "a",<br/>  "b",<br/>  "c"<br/>]</pre> |
 | <a name="input_input_with_underscores"></a> [input_with_underscores](#input_input_with_underscores) | A variable with underscores. | `any` | n/a |
 | <a name="input_input-with-pipe"></a> [input-with-pipe](#input_input-with-pipe) | It includes v1 \| v2 \| v3 | `string` | `"v1"` |
-| <a name="input_input-with-code-block"></a> [input-with-code-block](#input_input-with-code-block) | This is a complicated one. We need a newline.<br>And an example in a code block<pre>default     = [<br>  "machine rack01:neptune"<br>]</pre> | `list` | <pre>[<br>  "name rack:location"<br>]</pre> |
-| <a name="input_long_type"></a> [long_type](#input_long_type) | This description is itself markdown.<br><br>It spans over multiple lines. | <pre>object({<br>    name = string,<br>    foo  = object({ foo = string, bar = string }),<br>    bar  = object({ foo = string, bar = string }),<br>    fizz = list(string),<br>    buzz = list(string)<br>  })</pre> | <pre>{<br>  "bar": {<br>    "bar": "bar",<br>    "foo": "bar"<br>  },<br>  "buzz": [<br>    "fizz",<br>    "buzz"<br>  ],<br>  "fizz": [],<br>  "foo": {<br>    "bar": "foo",<br>    "foo": "foo"<br>  },<br>  "name": "hello"<br>}</pre> |
+| <a name="input_input-with-code-block"></a> [input-with-code-block](#input_input-with-code-block) | This is a complicated one. We need a newline.<br/>And an example in a code block<pre>default     = [<br/>  "machine rack01:neptune"<br/>]</pre> | `list` | <pre>[<br/>  "name rack:location"<br/>]</pre> |
+| <a name="input_long_type"></a> [long_type](#input_long_type) | This description is itself markdown.<br/><br/>It spans over multiple lines. | <pre>object({<br/>    name = string,<br/>    foo  = object({ foo = string, bar = string }),<br/>    bar  = object({ foo = string, bar = string }),<br/>    fizz = list(string),<br/>    buzz = list(string)<br/>  })</pre> | <pre>{<br/>  "bar": {<br/>    "bar": "bar",<br/>    "foo": "bar"<br/>  },<br/>  "buzz": [<br/>    "fizz",<br/>    "buzz"<br/>  ],<br/>  "fizz": [],<br/>  "foo": {<br/>    "bar": "foo",<br/>    "foo": "foo"<br/>  },<br/>  "name": "hello"<br/>}</pre> |
 | <a name="input_no-escape-default-value"></a> [no-escape-default-value](#input_no-escape-default-value) | The description contains `something_with_underscore`. Defaults to 'VALUE_WITH_UNDERSCORE'. | `string` | `"VALUE_WITH_UNDERSCORE"` |
 | <a name="input_with-url"></a> [with-url](#input_with-url) | The description contains url. https://www.domain.com/foo/bar_baz.html | `string` | `""` |
 | <a name="input_string_default_empty"></a> [string_default_empty](#input_string_default_empty) | n/a | `string` | `""` |
diff --git a/format/testdata/markdown/table-WithRequired.golden b/format/testdata/markdown/table-WithRequired.golden
index 08ed2ee..8e335e5 100644
--- a/format/testdata/markdown/table-WithRequired.golden
+++ b/format/testdata/markdown/table-WithRequired.golden
@@ -92,14 +92,14 @@ followed by another line of text.
 | number-1 | It's number number one. | `number` | `42` | no |
 | map-3 | n/a | `map` | `{}` | no |
 | map-2 | It's map number two. | `map` | n/a | yes |
-| map-1 | It's map number one. | `map` | <pre>{<br>  "a": 1,<br>  "b": 2,<br>  "c": 3<br>}</pre> | no |
+| map-1 | It's map number one. | `map` | <pre>{<br/>  "a": 1,<br/>  "b": 2,<br/>  "c": 3<br/>}</pre> | no |
 | list-3 | n/a | `list` | `[]` | no |
 | list-2 | It's list number two. | `list` | n/a | yes |
-| list-1 | It's list number one. | `list` | <pre>[<br>  "a",<br>  "b",<br>  "c"<br>]</pre> | no |
+| list-1 | It's list number one. | `list` | <pre>[<br/>  "a",<br/>  "b",<br/>  "c"<br/>]</pre> | no |
 | input_with_underscores | A variable with underscores. | `any` | n/a | yes |
 | input-with-pipe | It includes v1 \| v2 \| v3 | `string` | `"v1"` | no |
-| input-with-code-block | This is a complicated one. We need a newline.<br>And an example in a code block<pre>default     = [<br>  "machine rack01:neptune"<br>]</pre> | `list` | <pre>[<br>  "name rack:location"<br>]</pre> | no |
-| long_type | This description is itself markdown.<br><br>It spans over multiple lines. | <pre>object({<br>    name = string,<br>    foo  = object({ foo = string, bar = string }),<br>    bar  = object({ foo = string, bar = string }),<br>    fizz = list(string),<br>    buzz = list(string)<br>  })</pre> | <pre>{<br>  "bar": {<br>    "bar": "bar",<br>    "foo": "bar"<br>  },<br>  "buzz": [<br>    "fizz",<br>    "buzz"<br>  ],<br>  "fizz": [],<br>  "foo": {<br>    "bar": "foo",<br>    "foo": "foo"<br>  },<br>  "name": "hello"<br>}</pre> | no |
+| input-with-code-block | This is a complicated one. We need a newline.<br/>And an example in a code block<pre>default     = [<br/>  "machine rack01:neptune"<br/>]</pre> | `list` | <pre>[<br/>  "name rack:location"<br/>]</pre> | no |
+| long_type | This description is itself markdown.<br/><br/>It spans over multiple lines. | <pre>object({<br/>    name = string,<br/>    foo  = object({ foo = string, bar = string }),<br/>    bar  = object({ foo = string, bar = string }),<br/>    fizz = list(string),<br/>    buzz = list(string)<br/>  })</pre> | <pre>{<br/>  "bar": {<br/>    "bar": "bar",<br/>    "foo": "bar"<br/>  },<br/>  "buzz": [<br/>    "fizz",<br/>    "buzz"<br/>  ],<br/>  "fizz": [],<br/>  "foo": {<br/>    "bar": "foo",<br/>    "foo": "foo"<br/>  },<br/>  "name": "hello"<br/>}</pre> | no |
 | no-escape-default-value | The description contains `something_with_underscore`. Defaults to 'VALUE_WITH_UNDERSCORE'. | `string` | `"VALUE_WITH_UNDERSCORE"` | no |
 | with-url | The description contains url. https://www.domain.com/foo/bar_baz.html | `string` | `""` | no |
 | string_default_empty | n/a | `string` | `""` | no |
diff --git a/format/testdata/markdown/table-WithoutDefault.golden b/format/testdata/markdown/table-WithoutDefault.golden
index 082b876..8cc8b3b 100644
--- a/format/testdata/markdown/table-WithoutDefault.golden
+++ b/format/testdata/markdown/table-WithoutDefault.golden
@@ -22,8 +22,8 @@
 | list-1 | It's list number one. | `list` |
 | input_with_underscores | A variable with underscores. | `any` |
 | input-with-pipe | It includes v1 \| v2 \| v3 | `string` |
-| input-with-code-block | This is a complicated one. We need a newline.<br>And an example in a code block<pre>default     = [<br>  "machine rack01:neptune"<br>]</pre> | `list` |
-| long_type | This description is itself markdown.<br><br>It spans over multiple lines. | <pre>object({<br>    name = string,<br>    foo  = object({ foo = string, bar = string }),<br>    bar  = object({ foo = string, bar = string }),<br>    fizz = list(string),<br>    buzz = list(string)<br>  })</pre> |
+| input-with-code-block | This is a complicated one. We need a newline.<br/>And an example in a code block<pre>default     = [<br/>  "machine rack01:neptune"<br/>]</pre> | `list` |
+| long_type | This description is itself markdown.<br/><br/>It spans over multiple lines. | <pre>object({<br/>    name = string,<br/>    foo  = object({ foo = string, bar = string }),<br/>    bar  = object({ foo = string, bar = string }),<br/>    fizz = list(string),<br/>    buzz = list(string)<br/>  })</pre> |
 | no-escape-default-value | The description contains `something_with_underscore`. Defaults to 'VALUE_WITH_UNDERSCORE'. | `string` |
 | with-url | The description contains url. https://www.domain.com/foo/bar_baz.html | `string` |
 | string_default_empty | n/a | `string` |
diff --git a/format/testdata/markdown/table-WithoutType.golden b/format/testdata/markdown/table-WithoutType.golden
index b9345a3..56f65f3 100644
--- a/format/testdata/markdown/table-WithoutType.golden
+++ b/format/testdata/markdown/table-WithoutType.golden
@@ -16,14 +16,14 @@
 | number-1 | It's number number one. | `42` |
 | map-3 | n/a | `{}` |
 | map-2 | It's map number two. | n/a |
-| map-1 | It's map number one. | <pre>{<br>  "a": 1,<br>  "b": 2,<br>  "c": 3<br>}</pre> |
+| map-1 | It's map number one. | <pre>{<br/>  "a": 1,<br/>  "b": 2,<br/>  "c": 3<br/>}</pre> |
 | list-3 | n/a | `[]` |
 | list-2 | It's list number two. | n/a |
-| list-1 | It's list number one. | <pre>[<br>  "a",<br>  "b",<br>  "c"<br>]</pre> |
+| list-1 | It's list number one. | <pre>[<br/>  "a",<br/>  "b",<br/>  "c"<br/>]</pre> |
 | input_with_underscores | A variable with underscores. | n/a |
 | input-with-pipe | It includes v1 \| v2 \| v3 | `"v1"` |
-| input-with-code-block | This is a complicated one. We need a newline.<br>And an example in a code block<pre>default     = [<br>  "machine rack01:neptune"<br>]</pre> | <pre>[<br>  "name rack:location"<br>]</pre> |
-| long_type | This description is itself markdown.<br><br>It spans over multiple lines. | <pre>{<br>  "bar": {<br>    "bar": "bar",<br>    "foo": "bar"<br>  },<br>  "buzz": [<br>    "fizz",<br>    "buzz"<br>  ],<br>  "fizz": [],<br>  "foo": {<br>    "bar": "foo",<br>    "foo": "foo"<br>  },<br>  "name": "hello"<br>}</pre> |
+| input-with-code-block | This is a complicated one. We need a newline.<br/>And an example in a code block<pre>default     = [<br/>  "machine rack01:neptune"<br/>]</pre> | <pre>[<br/>  "name rack:location"<br/>]</pre> |
+| long_type | This description is itself markdown.<br/><br/>It spans over multiple lines. | <pre>{<br/>  "bar": {<br/>    "bar": "bar",<br/>    "foo": "bar"<br/>  },<br/>  "buzz": [<br/>    "fizz",<br/>    "buzz"<br/>  ],<br/>  "fizz": [],<br/>  "foo": {<br/>    "bar": "foo",<br/>    "foo": "foo"<br/>  },<br/>  "name": "hello"<br/>}</pre> |
 | no-escape-default-value | The description contains `something_with_underscore`. Defaults to 'VALUE_WITH_UNDERSCORE'. | `"VALUE_WITH_UNDERSCORE"` |
 | with-url | The description contains url. https://www.domain.com/foo/bar_baz.html | `""` |
 | string_default_empty | n/a | `""` |
diff --git a/template/sanitizer_test.go b/template/sanitizer_test.go
index e4fb7e7..cf787d9 100644
--- a/template/sanitizer_test.go
+++ b/template/sanitizer_test.go
@@ -301,7 +301,7 @@ func TestConvertMultiLineText(t *testing.T) {
 			filename: "newline-single",
 			isTable:  true,
 			showHTML: true,
-			expected: "Lorem ipsum dolor sit amet,<br><br>consectetur adipiscing elit,<br><br>sed do eiusmod tempor incididunt<br><br>ut labore et dolore magna aliqua.",
+			expected: "Lorem ipsum dolor sit amet,<br/><br/>consectetur adipiscing elit,<br/><br/>sed do eiusmod tempor incididunt<br/><br/>ut labore et dolore magna aliqua.",
 		},
 		{
 			name:     "convert multi-line newline-single",
@@ -322,7 +322,7 @@ func TestConvertMultiLineText(t *testing.T) {
 			filename: "newline-double",
 			isTable:  true,
 			showHTML: true,
-			expected: "Lorem ipsum dolor sit amet,<br><br><br>consectetur adipiscing elit,<br><br><br>sed do eiusmod tempor incididunt<br><br><br>ut labore et dolore magna aliqua.",
+			expected: "Lorem ipsum dolor sit amet,<br/><br/><br/>consectetur adipiscing elit,<br/><br/><br/>sed do eiusmod tempor incididunt<br/><br/><br/>ut labore et dolore magna aliqua.",
 		},
 		{
 			name:     "convert multi-line newline-double",
@@ -343,7 +343,7 @@ func TestConvertMultiLineText(t *testing.T) {
 			filename: "paragraph",
 			isTable:  true,
 			showHTML: true,
-			expected: "Lorem ipsum dolor sit amet,<br>consectetur adipiscing elit,<br>sed do eiusmod tempor incididunt<br>ut labore et dolore magna aliqua.",
+			expected: "Lorem ipsum dolor sit amet,<br/>consectetur adipiscing elit,<br/>sed do eiusmod tempor incididunt<br/>ut labore et dolore magna aliqua.",
 		},
 		{
 			name:     "convert multi-line paragraph",
@@ -364,7 +364,7 @@ func TestConvertMultiLineText(t *testing.T) {
 			filename: "list",
 			isTable:  true,
 			showHTML: true,
-			expected: "- Lorem ipsum dolor sit amet,<br>  * Lorem ipsum dolor sit amet,<br>  * consectetur adipiscing elit,<br>- consectetur adipiscing elit,<br>- sed do eiusmod tempor incididunt<br>- ut labore et dolore magna aliqua.",
+			expected: "- Lorem ipsum dolor sit amet,<br/>  * Lorem ipsum dolor sit amet,<br/>  * consectetur adipiscing elit,<br/>- consectetur adipiscing elit,<br/>- sed do eiusmod tempor incididunt<br/>- ut labore et dolore magna aliqua.",
 		},
 		{
 			name:     "convert multi-line list",
@@ -385,7 +385,7 @@ func TestConvertMultiLineText(t *testing.T) {
 			filename: "indentations",
 			isTable:  true,
 			showHTML: true,
-			expected: "This is is a multline test which works<br><br>Key<br>  Foo1: blah<br>  Foo2: blah<br><br>Key2<br>Foo1: bar1<br>Foo2: bar2",
+			expected: "This is is a multline test which works<br/><br/>Key<br/>  Foo1: blah<br/>  Foo2: blah<br/><br/>Key2<br/>Foo1: bar1<br/>Foo2: bar2",
 		},
 		{
 			name:     "convert multi-line indentations",
diff --git a/template/template_test.go b/template/template_test.go
index 37f97da..cc8c08a 100644
--- a/template/template_test.go
+++ b/template/template_test.go
@@ -398,14 +398,14 @@ func TestBuiltinFunc(t *testing.T) {
 			funcName: "sanitizeMarkdownTbl",
 			funcArgs: []string{"\"Example of 'foo_bar' module in `foo_bar.tf`.\n\n| Foo | Bar |\""},
 			escape:   true,
-			expected: "Example of 'foo\\_bar' module in `foo_bar.tf`.<br><br>\\| Foo \\| Bar \\|",
+			expected: "Example of 'foo\\_bar' module in `foo_bar.tf`.<br/><br/>\\| Foo \\| Bar \\|",
 		},
 		{
 			name:     "template builtin functions sanitizeMarkdownTbl",
 			funcName: "sanitizeMarkdownTbl",
 			funcArgs: []string{"\"Example of 'foo_bar' module in `foo_bar.tf`.\n\n| Foo | Bar |\""},
 			escape:   false,
-			expected: "Example of 'foo_bar' module in `foo_bar.tf`.<br><br>\\| Foo \\| Bar \\|",
+			expected: "Example of 'foo_bar' module in `foo_bar.tf`.<br/><br/>\\| Foo \\| Bar \\|",
 		},
 		{
 			name:     "template builtin functions sanitizeMarkdownTbl",
diff --git a/template/testdata/table/codeblock-html.markdown.expected b/template/testdata/table/codeblock-html.markdown.expected
index 8e60f2a..a70db77 100644
--- a/template/testdata/table/codeblock-html.markdown.expected
+++ b/template/testdata/table/codeblock-html.markdown.expected
@@ -1,1 +1,1 @@
-This is a complicated one. We need a newline.<br>And an example in a code block. Availeble options<br>are: foo \| bar \| baz<pre>default = [<br>  "foo"<br>]</pre>
\ No newline at end of file
+This is a complicated one. We need a newline.<br/>And an example in a code block. Availeble options<br/>are: foo \| bar \| baz<pre>default = [<br/>  "foo"<br/>]</pre>
\ No newline at end of file
diff --git a/template/testdata/table/complex-html.markdown.expected b/template/testdata/table/complex-html.markdown.expected
index c822e02..dd0ac73 100644
--- a/template/testdata/table/complex-html.markdown.expected
+++ b/template/testdata/table/complex-html.markdown.expected
@@ -1,1 +1,1 @@
-Usage:<br><br>Example of 'foo\_bar' module in `foo_bar.tf`.<br><br>- list item 1<br>- list item 2<br><br>Even inline **formatting** in _here_ is possible.<br>and some [link](https://domain.com/)<br><br>* list item 3<br>* list item 4<pre>module "foo_bar" {<br>  source = "github.com/foo/bar"<br><br>  id   = "1234567890"<br>  name = "baz"<br><br>  zones = ["us-east-1", "us-west-1"]<br><br>  tags = {<br>    Name         = "baz"<br>    Created-By   = "first.last@email.com"<br>    Date-Created = "20180101"<br>  }<br>}</pre>Here is some trailing text after code block,<br>followed by another line of text.<br><br>\| Name \| Description     \|<br>\|------\|-----------------\|<br>\| Foo  \| Foo description \|<br>\| Bar  \| Bar description \|
\ No newline at end of file
+Usage:<br/><br/>Example of 'foo\_bar' module in `foo_bar.tf`.<br/><br/>- list item 1<br/>- list item 2<br/><br/>Even inline **formatting** in _here_ is possible.<br/>and some [link](https://domain.com/)<br/><br/>* list item 3<br/>* list item 4<pre>module "foo_bar" {<br/>  source = "github.com/foo/bar"<br/><br/>  id   = "1234567890"<br/>  name = "baz"<br/><br/>  zones = ["us-east-1", "us-west-1"]<br/><br/>  tags = {<br/>    Name         = "baz"<br/>    Created-By   = "first.last@email.com"<br/>    Date-Created = "20180101"<br/>  }<br/>}</pre>Here is some trailing text after code block,<br/>followed by another line of text.<br/><br/>\| Name \| Description     \|<br/>\|------\|-----------------\|<br/>\| Foo  \| Foo description \|<br/>\| Bar  \| Bar description \|
\ No newline at end of file