File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
packages/@vuepress/shared-utils/src Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -15,9 +15,9 @@ import parseEmojis from './parseEmojis'
15
15
// wrapped by <code>(markdown token: '`') tag.
16
16
17
17
const removeMarkdownTokens = ( str : string ) : string => String ( str )
18
- . replace ( / \[ ( .* ) \] \( . * \) / , '$1' ) // []()
19
- . replace ( / ( ` | \* { 1 , 3 } | _ ) ( .* ?[ ^ \\ ] ) \1/ g, '$2' ) // `{t}` | *{t}* | **{t}** | ***{t}*** | _{t}_
20
- . replace ( / ( \\ ) ( \* | _ | ` | \! ) / g, '$2' ) // remove escape char '\'
18
+ . replace ( / ( \[ ( .[ ^ \] ] + ) \] \( ( . [ ^ ) ] + ) \) ) / g , '$2' ) // []()
19
+ . replace ( / ( ` | \* { 1 , 3 } | _ ) ( .* ?[ ^ \\ ] ) \1/ g, '$2' ) // `{t}` | *{t}* | **{t}** | ***{t}*** | _{t}_
20
+ . replace ( / ( \\ ) ( \* | _ | ` | \! | < ) / g, '$2' ) // remove escape char '\'
21
21
22
22
const trim = ( str : string ) : string => str . trim ( )
23
23
Original file line number Diff line number Diff line change 3
3
// Input: "<a> b", Output: "b"
4
4
// Input: "`<a>` b", Output: "`<a>` b"
5
5
export = function removeNonCodeWrappedHTML ( str : string ) : string {
6
- return String ( str ) . replace ( / ( ^ | [ ^ > < ` ] ) < .* > ( [ ^ > < ` ] | $ ) / g, '$1$2' )
6
+ return String ( str ) . replace ( / ( ^ | [ ^ > < ` \\ ] ) < .* > ( [ ^ > < ` ] | $ ) / g, '$1$2' )
7
7
}
You can’t perform that action at this time.
0 commit comments