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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy