Skip to content

Commit 5fea6e8

Browse files
Added handling of remaining tags (except img and comments)
1 parent 3baf3b7 commit 5fea6e8

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

goso.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const (
3535
var (
3636
codeStartIdx int
3737
codeEndIdx int
38+
// https://meta.stackexchange.com/questions/1777/what-html-tags-are-allowed-on-stack-exchange-sites
3839
codePattern = regexp.MustCompile(`<pre\s.*?>`)
3940
aHrefPattern = regexp.MustCompile(`(?s)<a\s+(?:[^>]*?\s+)?href=(["'])?([^\'" >]+)(.*?)?</a>`)
4041
divPattern = regexp.MustCompile(`<div.*?>`)
@@ -48,6 +49,8 @@ var (
4849
"</strong>", reset,
4950
"<em>", italic,
5051
"</em>", reset,
52+
"<i>", italic,
53+
"</i>", reset,
5154
"<ul>", "",
5255
"</ul>", "",
5356
"<ol>", "",
@@ -67,13 +70,15 @@ var (
6770
"</h4>", reset,
6871
"<h5>", bold,
6972
"</h5>", reset,
73+
"<h6>", bold,
74+
"</h6>", reset,
7075
"<br>", "\n",
7176
"<blockquote>", italic,
7277
"</blockquote>", reset,
7378
"<del>", strikethrough,
7479
"</del>", reset,
75-
"<ins>", "",
76-
"</ins>", "",
80+
"<s>", strikethrough,
81+
"</s>", reset,
7782
"</div>", "",
7883
"<code>", green,
7984
"</code>", reset,
@@ -83,6 +88,12 @@ var (
8388
"</sup>", "",
8489
"<sub>", "",
8590
"</sub>", "",
91+
"<dl>", "",
92+
"</dl>", "",
93+
"<dt>", "",
94+
"</dt>", "",
95+
"<dd>", " - ",
96+
"</dd>", "",
8697
)
8798
)
8899

0 commit comments

Comments
 (0)