Commit 3b05382
committed
Escape raw rule doc text for HTML
Some the rule config text is intended for use in both tool output and in the reference, so can't be formatted at the
source as the Markdown consumed by the MkDocs website generation system.
This raw text may contain incidental Markdown markup, which would result in it being incorrectly rendered in the
website, so it must be escaped. Despite much searching at the time the rule documentation website generation system was
created, I could not find a good Go package for Markdown escaping of text. I did find an excellent package for Markdown
escaping of HTML, and so I used that instead.
However, this is not sufficient to completely escape the text. The reason is that Markdown is a partial superset of
HTML. The `github.com/JohannesKaufmann/html-to-markdown/escape` package intentionally does not escape HTML. So it is
necessary to do HTML escaping of the raw text in addition to Markdown escaping.
HTML escaping was not done previously, which resulted in raw text which incidentally had the angle bracket enclosed form
of HTML tags not being rendered in the website.
For example, the "brief" text of rule PF009:
```
use of compiler.<pattern type>.extra_flags
```
was rendered as:
```
use of compiler..extra_flags
```
The raw text is now escaped both for HTML and for Markdown during the generation of the rule documentation website
content.1 parent f7c0a9a commit 3b05382
3 files changed
+44
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
59 | | - | |
60 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
111 | 128 | | |
112 | 129 | | |
113 | 130 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
0 commit comments