Skip to content

Commit

Permalink
Fix getAndRemoveConfig regex (docsifyjs#708)
Browse files Browse the repository at this point in the history
* Fix getAndRemoveConfig regex

Update getAndRemoveConfig regular expression for prevent cases, when header has name like "foo::bar::baz".

* Fix wrong regexp

* Fix regex

Ignore `:foo` cases
  • Loading branch information
bashkirtsevich authored and QingWei-Li committed Dec 5, 2018
1 parent 28beff8 commit 6ac7bac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/render/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function getAndRemoveConfig(str = '') {
str = str
.replace(/^'/, '')
.replace(/'$/, '')
.replace(/:([\w-]+)=?([\w-]+)?/g, (m, key, value) => {
.replace(/(?:^|\s):([\w-]+)=?([\w-]+)?/g, (m, key, value) => {
config[key] = (value && value.replace(/"/g, '')) || true
return ''
})
Expand Down

0 comments on commit 6ac7bac

Please sign in to comment.