Skip to content

Commit

Permalink
refactor(regex): simplify regular expression
Browse files Browse the repository at this point in the history
  • Loading branch information
ph1p committed Aug 31, 2021
1 parent fbd03cc commit 413ee2b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/helpers/comment-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fm from 'front-matter';

const parseComment = (fileContent: string) => {
try {
const allCommentBlocks = fileContent.match(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/g);
const allCommentBlocks = fileContent.match(/\/*[\s\S]*\/.*/g);
const vuepressBlock = allCommentBlocks?.filter((block: string) => {
return block.split('\n').filter(line => line.indexOf('@vuepress') >= 0).length;
})[0];
Expand Down

0 comments on commit 413ee2b

Please sign in to comment.