@@ -16,7 +16,7 @@ import (
1616var multipleSpacesR = regexp .MustCompile (` +` )
1717
1818var commonmark = []Rule {
19- Rule {
19+ {
2020 Filter : []string {"ul" , "ol" },
2121 Replacement : func (content string , selec * goquery.Selection , opt * Options ) * string {
2222 parent := selec .Parent ()
@@ -42,7 +42,7 @@ var commonmark = []Rule{
4242 return & content
4343 },
4444 },
45- Rule {
45+ {
4646 Filter : []string {"li" },
4747 Replacement : func (content string , selec * goquery.Selection , opt * Options ) * string {
4848 if strings .TrimSpace (content ) == "" {
@@ -68,7 +68,7 @@ var commonmark = []Rule{
6868 return String (prefix + content + "\n " )
6969 },
7070 },
71- Rule {
71+ {
7272 Filter : []string {"#text" },
7373 Replacement : func (content string , selec * goquery.Selection , opt * Options ) * string {
7474 text := selec .Text ()
@@ -85,7 +85,7 @@ var commonmark = []Rule{
8585 return & text
8686 },
8787 },
88- Rule {
88+ {
8989 Filter : []string {"p" , "div" },
9090 Replacement : func (content string , selec * goquery.Selection , opt * Options ) * string {
9191 parent := goquery .NodeName (selec .Parent ())
@@ -101,7 +101,7 @@ var commonmark = []Rule{
101101 return & content
102102 },
103103 },
104- Rule {
104+ {
105105 Filter : []string {"h1" , "h2" , "h3" , "h4" , "h5" , "h6" },
106106 Replacement : func (content string , selec * goquery.Selection , opt * Options ) * string {
107107 if strings .TrimSpace (content ) == "" {
@@ -141,7 +141,7 @@ var commonmark = []Rule{
141141 return & text
142142 },
143143 },
144- Rule {
144+ {
145145 Filter : []string {"strong" , "b" },
146146 Replacement : func (content string , selec * goquery.Selection , opt * Options ) * string {
147147 // only use one bold tag if they are nested
@@ -162,7 +162,7 @@ var commonmark = []Rule{
162162 return & trimmed
163163 },
164164 },
165- Rule {
165+ {
166166 Filter : []string {"i" , "em" },
167167 Replacement : func (content string , selec * goquery.Selection , opt * Options ) * string {
168168 // only use one italic tag if they are nested
@@ -183,7 +183,7 @@ var commonmark = []Rule{
183183 return & trimmed
184184 },
185185 },
186- Rule {
186+ {
187187 Filter : []string {"img" },
188188 Replacement : func (content string , selec * goquery.Selection , opt * Options ) * string {
189189 alt := selec .AttrOr ("alt" , "" )
@@ -209,7 +209,7 @@ var commonmark = []Rule{
209209 return & text
210210 },
211211 },
212- Rule {
212+ {
213213 Filter : []string {"a" },
214214 AdvancedReplacement : func (content string , selec * goquery.Selection , opt * Options ) (AdvancedResult , bool ) {
215215 // if there is no href, no link is used. So just return the content inside the link
@@ -270,7 +270,7 @@ var commonmark = []Rule{
270270 return AdvancedResult {Markdown : replacement , Footer : reference }, false
271271 },
272272 },
273- Rule {
273+ {
274274 Filter : []string {"code" },
275275 Replacement : func (_ string , selec * goquery.Selection , opt * Options ) * string {
276276 content := selec .Text ()
@@ -280,7 +280,7 @@ var commonmark = []Rule{
280280 return & text
281281 },
282282 },
283- Rule {
283+ {
284284 Filter : []string {"pre" },
285285 Replacement : func (content string , selec * goquery.Selection , opt * Options ) * string {
286286 codeElement := selec .Find ("code" )
@@ -301,20 +301,20 @@ var commonmark = []Rule{
301301 return & text
302302 },
303303 },
304- Rule {
304+ {
305305 Filter : []string {"hr" },
306306 Replacement : func (content string , selec * goquery.Selection , opt * Options ) * string {
307307 text := "\n \n " + opt .HorizontalRule + "\n \n "
308308 return & text
309309 },
310310 },
311- Rule {
311+ {
312312 Filter : []string {"br" },
313313 Replacement : func (content string , selec * goquery.Selection , opt * Options ) * string {
314314 return String ("\n \n " )
315315 },
316316 },
317- Rule {
317+ {
318318 Filter : []string {"blockquote" },
319319 Replacement : func (content string , selec * goquery.Selection , opt * Options ) * string {
320320 content = strings .TrimSpace (content )
@@ -331,7 +331,7 @@ var commonmark = []Rule{
331331 return & text
332332 },
333333 },
334- Rule {
334+ {
335335 Filter : []string {"noscript" },
336336 Replacement : func (content string , selec * goquery.Selection , opt * Options ) * string {
337337 // for now remove the contents of noscript. But in the future we could
0 commit comments