File tree Expand file tree Collapse file tree 2 files changed +625
-14
lines changed Expand file tree Collapse file tree 2 files changed +625
-14
lines changed Original file line number Diff line number Diff line change @@ -249,6 +249,7 @@ func (o *output) validate() error {
249
249
return nil
250
250
}
251
251
252
+ o .Template = strings .ReplaceAll (o .Template , "\\ n" , "\n " )
252
253
lines := strings .Split (o .Template , "\n " )
253
254
tests := []struct {
254
255
condition func () bool
@@ -291,24 +292,27 @@ func (o *output) validate() error {
291
292
// ref: https://www.jamestharpe.com/markdown-comments/
292
293
func isInlineComment (line string ) bool {
293
294
switch {
294
- // Markdown specific
295
- case strings .HasPrefix (line , "<!--" ) && strings .HasSuffix (line , "-->" ):
296
- return true
297
- case strings .HasPrefix (line , "[]: # (" ):
298
- return true
299
- case strings .HasPrefix (line , "[]: # \" " ):
300
- return true
301
- case strings .HasPrefix (line , "[]: # '" ):
302
- return true
303
- case strings .HasPrefix (line , "[//]: # (" ):
304
- return true
305
- case strings .HasPrefix (line , "[comment]: # (" ):
306
- return true
307
-
308
295
// AsciiDoc specific
309
296
case strings .HasPrefix (line , "//" ):
310
297
return true
298
+
299
+ // Markdown specific
300
+ default :
301
+ cases := [][]string {
302
+ {"<!--" , "-->" },
303
+ {"[]: # (" , ")" },
304
+ {"[]: # \" " , "\" " },
305
+ {"[]: # '" , "'" },
306
+ {"[//]: # (" , ")" },
307
+ {"[comment]: # (" , ")" },
308
+ }
309
+ for _ , c := range cases {
310
+ if strings .HasPrefix (line , c [0 ]) && strings .HasSuffix (line , c [1 ]) {
311
+ return true
312
+ }
313
+ }
311
314
}
315
+
312
316
return false
313
317
}
314
318
You can’t perform that action at this time.
0 commit comments