Repository: terraform-docs/terraform-docs (go)

Issue:
Alone bold line formatting is escaped with markdown document 
<!-- Please note, this template is for bugs report, not feature requests -->
<!-- For more information, see the Contributing Guidelines at -->
<!-- https://github.com/terraform-docs/terraform-docs/tree/master/CONTRIBUTING.md -->

**Describe the bug**
Using the output markdown document, I have an issue with alone bold line formatting. The `*` character is always escaped during generation.
 
**To Reproduce**

Steps to reproduce the behavior:

1. Create a module with a main.tf
2. Put those lines in main.tf:
```
/**
* **Please, read this line before starting**
*/
```
3. Run `terraform-docs markdown . > README.md` in module folder 
4. Content of README.md:
```markdown
\*\*Please, read this line before starting\*\*
```

**Expected behavior**

```markdown
**Please, read this line before starting**
```

**Version information:**

- terraform-docs version: 0.10.1
- OS: Ubuntu



Pull request:
Do not escape asterisk in markdown or asciidoc
<!--
Thank you for helping to improve terraform-docs!

Please read through https://git.io/JtEzg if this is your first time opening a
terraform-docs pull request. Find us in https://slack.terraform-docs.io/messages/dev if
you need any help contributing.
-->

### Description of your changes

<!--
Briefly describe what this pull request does. Be sure to direct your reviewers'
attention to anything that needs special consideration.

We love pull requests that resolve an open terraform-docs issue. If yours does, you
can uncomment the below line to indicate which issue your PR fixes, for example
"Fixes #500":
-->

Originally '*' was included in illegal characters to be escaped,
specifically when formatter is markdown or asciidoc. But there's no
real point of escaping asterisk, as markdown engines will process them
properly.

Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>

Fixes #351 

I have:

- [x] Read and followed terraform-docs' [contribution process].
- [x] 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.
-->

Add corresponding test cases and make sure `make test` passes.

[contribution process]: https://git.io/JtEzg


Patch:
diff --git a/internal/template/sanitizer.go b/internal/template/sanitizer.go
index e1b6f21..b7b0020 100644
--- a/internal/template/sanitizer.go
+++ b/internal/template/sanitizer.go
@@ -187,7 +187,6 @@ func escapeIllegalCharacters(s string, settings *print.Settings) string {
 						line = strings.Replace(line, "‡‡‡DONTESCAPE‡‡‡", char, -1)
 					}
 					escape("_") // Escape underscore
-					escape("*") // Escape asterisk
 					return line
 				})
 			},


Test patch:
diff --git a/internal/template/sanitizer_test.go b/internal/template/sanitizer_test.go
index cebfef0..3572799 100644
--- a/internal/template/sanitizer_test.go
+++ b/internal/template/sanitizer_test.go
@@ -418,21 +418,28 @@ func TestEscapeIllegalCharacters(t *testing.T) {
 			input:       "* lorem * ipsum *dolor*consectetur* `adipi * scing *elit*sit*`",
 			escapePipe:  false,
 			escapeChars: true,
-			expected:    "* lorem \\* ipsum *dolor\\*consectetur* `adipi * scing *elit*sit*`",
+			expected:    "* lorem * ipsum *dolor*consectetur* `adipi * scing *elit*sit*`",
 		},
 		{
 			name:        "escape asterisk",
 			input:       "** lorem ** ipsum **dolor**consectetur** `adipi ** scing **elit**sit**`",
 			escapePipe:  false,
 			escapeChars: true,
-			expected:    "** lorem \\*\\* ipsum **dolor\\*\\*consectetur** `adipi ** scing **elit**sit**`",
+			expected:    "** lorem ** ipsum **dolor**consectetur** `adipi ** scing **elit**sit**`",
 		},
 		{
 			name:        "escape asterisk",
 			input:       "*** lorem *** ipsum ***dolor***consectetur*** `adipi *** scing ***elit***sit***`",
 			escapePipe:  false,
 			escapeChars: true,
-			expected:    "*** lorem \\*\\*\\* ipsum ***dolor\\*\\*\\*consectetur*** `adipi *** scing ***elit***sit***`",
+			expected:    "*** lorem *** ipsum ***dolor***consectetur*** `adipi *** scing ***elit***sit***`",
+		},
+		{
+			name:        "escape asterisk",
+			input:       "**lorem ipsum dolor consectetur adipi scing elit sit**",
+			escapePipe:  false,
+			escapeChars: true,
+			expected:    "**lorem ipsum dolor consectetur adipi scing elit sit**",
 		},
 		{
 			name:        "do not escape asterisk",
@@ -455,6 +462,13 @@ func TestEscapeIllegalCharacters(t *testing.T) {
 			escapeChars: false,
 			expected:    "*** lorem *** ipsum ***dolor***consectetur*** `adipi *** scing ***elit***sit***`",
 		},
+		{
+			name:        "do not escape asterisk",
+			input:       "**lorem ipsum dolor consectetur adipi scing elit sit**",
+			escapePipe:  false,
+			escapeChars: false,
+			expected:    "**lorem ipsum dolor consectetur adipi scing elit sit**",
+		},
 	}
 	for _, tt := range tests {
 		t.Run(tt.name, func(t *testing.T) {