Closed
Description
Initial checklist
- I read the support docs
- I read the contributing guide
- I agree to follow the code of conduct
- I searched issues and couldn’t find anything (or linked relevant results below)
Affected packages and versions
Link to runnable example
No response
Steps to reproduce
const processor = unified()
.use(rehypeParse, { fragment: true, emitParseErrors: true })
.use(rehypeFormat, { blanks: [], indent: 0 })
.use(rehypeStringify, { allowParseErrors: true})
const vfile = await processor.process('<button type="login">Click me</button>')
const text = vfile.toString()
Cannot compile unknown node `login`
at unknown (node_modules/.pnpm/[email protected]/node_modules/hast-util-to-html/lib/handle/index.js:46:9)
at one (node_modules/.pnpm/[email protected]/node_modules/zwitch/index.js:108:17)
at Object.one (node_modules/.pnpm/[email protected]/node_modules/hast-util-to-html/lib/index.js:234:10)
at Object.all (node_modules/.pnpm/[email protected]/node_modules/hast-util-to-html/lib/index.js:253:27)
at element (node_modules/.pnpm/[email protected]/node_modules/hast-util-to-html/lib/handle/element.js:78:25)
at one (node_modules/.pnpm/[email protected]/node_modules/zwitch/index.js:108:17)
at Object.one (node_modules/.pnpm/[email protected]/node_modules/hast-util-to-html/lib/index.js:234:10)
at Object.all (node_modules/.pnpm/[email protected]/node_modules/hast-util-to-html/lib/index.js:253:27)
at element (node_modules/.pnpm/[email protected]/node_modules/hast-util-to-html/lib/handle/element.js:78:25)
at one (node_modules/.pnpm/[email protected]/node_modules/zwitch/index.js:108:17)
Expected behavior
No error is thrown or I can allow undefined values on attributes when stringifying
Actual behavior
Crashes when type
is bogus value
Affected runtime and version
Affected package manager and version
Affected OS and version
No response
Build and bundle tools
No response