Skip to content

Commit

Permalink
fix: syntax error of esm dynamic import plugins(#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
qrac authored and Val-istar-Guo committed Mar 21, 2022
1 parent b844646 commit 43166de
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export interface RehypePrismOptions {
const rehypePrism: unifiedTypes.Plugin<[RehypePrismOptions?]> = (options?: RehypePrismOptions) => {
if (options && options.plugins) {
for (const plugin of options.plugins) {
require(`prismjs/plugins/line-numbers/prism-${plugin}`)
import(`prismjs/plugins/${plugin}/prism-${plugin}.js`)
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import rehypePrism from '../src/index.js'
test('rehype prism', t => {
const processor = unified()
.use(markdown)
.use(rehypePrism)
.use(rehypePrism, {plugins: ["toolbar", "copy-to-clipboard"]})
.use(remark2rehype)
.use(html)

Expand Down

0 comments on commit 43166de

Please sign in to comment.