File tree 3 files changed +9
-2
lines changed
3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,9 @@ module.exports = class Slugger {
13
13
let slug = value
14
14
. toLowerCase ( )
15
15
. trim ( )
16
+ // remove html tags
17
+ . replace ( / < ! ? \/ ? [ \w - ] + (?: .* ) ? \/ ? > / g, '' )
18
+ // remove unwanted chars
16
19
. replace ( / [ \u2000 - \u206F \u2E00 - \u2E7F \\ ' ! " # $ % & ( ) * + , . / : ; < = > ? @ [ \] ^ ` { | } ~ ] / g, '' )
17
20
. replace ( / \s / g, '-' ) ;
18
21
Original file line number Diff line number Diff line change
1
+ < h3 id ="heading-with-html "> Heading with < em > html</ em > </ h3 >
2
+
1
3
< h3 id ="heading-with-a-link "> Heading with a < a href ="http://github.com/ "> link</ a > </ h3 >
2
4
3
5
< h3 id ="heading-with-some-italic-text "> Heading with some < em > italic text</ em > </ h3 >
@@ -10,4 +12,4 @@ <h3 id="or-even-code">Or even <code>code</code></h3>
10
12
11
13
< h3 id ="what-about-strikethrough "> What about < del > strikethrough</ del > </ h3 >
12
14
13
- < h2 id ="and-a-ref-link "> And a ref < a href ="/some/url " title ="link to nowhere "> link</ a > </ h2 >
15
+ < h2 id ="and-a-ref-link "> And a ref < a href ="/some/url " title ="link to nowhere "> link</ a > </ h2 >
Original file line number Diff line number Diff line change
1
+ ### Heading with <em >html</em >
2
+
1
3
### Heading with a [ link] ( http://github.com/ )
2
4
3
5
### Heading with some _ italic text_
11
13
12
14
## And a ref [ link] [ destination ]
13
15
14
- [ destination ] : /some/url " link to nowhere "
16
+ [ destination ] : /some/url " link to nowhere "
You can’t perform that action at this time.
0 commit comments