Skip to content

Commit 4b1b89f

Browse files
Laurie BarthLaurie Barth
authored andcommitted
token won't always be clean, use regex instead
1 parent 6713e91 commit 4b1b89f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/prism/src/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@ export default ({ children, className: outerClassName, title, ...props }) => {
5757
}
5858

5959
const isInlineHighlighted = line => {
60+
const regex = new RegExp('// highlight-line$')
6061
for (let token of line) {
61-
if (token.content === '// highlight-line') {
62-
token.content = '' // remove the highlight-line comment now that we've acted on it
62+
if (regex.test(token.content)) {
63+
token.content = token.content.replace(regex, '') // remove the highlight-line comment now that we've acted on it
6364
return true
6465
}
6566
}

0 commit comments

Comments
 (0)