Skip to content

Commit

Permalink
Fix to throw error on file
Browse files Browse the repository at this point in the history
Closes GH-20.
  • Loading branch information
wooorm committed Oct 12, 2022
1 parent 98ad518 commit 9c42989
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function rehypeHighlight(options = {}) {
name = pos > -1 ? prefix.slice(0, pos) : prefix
}

return (tree) => {
return (tree, file) => {
// eslint-disable-next-line complexity
visit(tree, 'element', (node, _, givenParent) => {
const parent = /** @type {Node?} */ (givenParent)
Expand Down Expand Up @@ -108,7 +108,7 @@ export default function rehypeHighlight(options = {}) {
} catch (error) {
const exception = /** @type {Error} */ (error)
if (!ignoreMissing || !/Unknown language/.test(exception.message)) {
throw error
file.fail(exception, node, 'rehype-highlight:missing-language')
}

return
Expand Down

0 comments on commit 9c42989

Please sign in to comment.