Skip to content

Cannot compile unknown node login #44

Closed
@albinekb

Description

@albinekb

Initial checklist

Affected packages and versions

hast-util-to-html@9.0.3

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/hast-util-to-html@9.0.3/node_modules/hast-util-to-html/lib/handle/index.js:46:9)
    at one (node_modules/.pnpm/zwitch@2.0.4/node_modules/zwitch/index.js:108:17)
    at Object.one (node_modules/.pnpm/hast-util-to-html@9.0.3/node_modules/hast-util-to-html/lib/index.js:234:10)
    at Object.all (node_modules/.pnpm/hast-util-to-html@9.0.3/node_modules/hast-util-to-html/lib/index.js:253:27)
    at element (node_modules/.pnpm/hast-util-to-html@9.0.3/node_modules/hast-util-to-html/lib/handle/element.js:78:25)
    at one (node_modules/.pnpm/zwitch@2.0.4/node_modules/zwitch/index.js:108:17)
    at Object.one (node_modules/.pnpm/hast-util-to-html@9.0.3/node_modules/hast-util-to-html/lib/index.js:234:10)
    at Object.all (node_modules/.pnpm/hast-util-to-html@9.0.3/node_modules/hast-util-to-html/lib/index.js:253:27)
    at element (node_modules/.pnpm/hast-util-to-html@9.0.3/node_modules/hast-util-to-html/lib/handle/element.js:78:25)
    at one (node_modules/.pnpm/zwitch@2.0.4/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

node@20.17.0

Affected package manager and version

pnpm@9.4.0

Affected OS and version

No response

Build and bundle tools

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    🤞 phase/openPost is being triaged manually

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions