Skip to content

Commit

Permalink
refactor(regex): simplify regular expression
Browse files Browse the repository at this point in the history
ph1p committed Aug 31, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
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
@@ -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];

0 comments on commit 413ee2b

Please sign in to comment.