Revert "refactor(v2): improve regex matching code-block title (#3671)" (#3681)

This reverts commit 32425497f7.
This commit is contained in:
Alexey Pyltsyn 2020-11-04 14:52:52 +03:00 committed by GitHub
parent 5aca1d739c
commit 7c7e0c24f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -84,7 +84,7 @@ const highlightDirectiveRegex = (lang) => {
return getHighlightDirectiveRegex();
}
};
const codeBlockTitleRegex = /(?<=title=").*(?=")/;
const codeBlockTitleRegex = /title=".*"/;
export default ({
children,
@ -125,7 +125,9 @@ export default ({
// Tested above
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
codeBlockTitle = metastring
.match(codeBlockTitleRegex)![0];
.match(codeBlockTitleRegex)![0]
.split('title=')[1]
.replace(/"+/g, '');
}
let language =