Skip to content

Commit

Permalink
parse5@7.0.0 with full ESM support (github#28014)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbe authored May 26, 2022
1 parent c878b68 commit 2eee72f
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/render-content/plugins/code-header.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { h } from 'hastscript'
import octicons from '@primer/octicons'
import parse5 from 'parse5'
import { parse } from 'parse5'
import { fromParse5 } from 'hast-util-from-parse5'

const LANGUAGE_MAP = {
Expand Down Expand Up @@ -94,7 +94,7 @@ export default function addCodeHeader(node) {
const language = LANGUAGE_MAP[node.lang] || node.lang || 'Code'

const btnIconHtml = octicons.copy.toSVG()
const btnIconAst = parse5.parse(String(btnIconHtml), { sourceCodeLocationInfo: true })
const btnIconAst = parse(String(btnIconHtml), { sourceCodeLocationInfo: true })
const btnIcon = fromParse5(btnIconAst, { file: btnIconHtml })

// Need to create the header using Markdown AST utilities, to fit
Expand Down
89 changes: 82 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"msgpack5rpc": "^1.1.0",
"next": "^11.1.3",
"overload-protection": "^1.2.3",
"parse5": "^6.0.1",
"parse5": "7.0.0",
"port-used": "^2.0.8",
"quick-lru": "6.1.1",
"react": "^17.0.2",
Expand Down

0 comments on commit 2eee72f

Please sign in to comment.