Skip to content

error stringifying custom html element with text after #16

Closed
@ChristianMurphy

Description

@ChristianMurphy

Subject of the issue

const remark = require('remark')
remark().processSync('<web-component>t')

results in

TypeError: Cannot read property 'replace' of undefined
    at phrasing (/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js:35:65)
    at Object.paragraph (/node_modules/mdast-util-to-markdown/lib/handle/paragraph.js:8:15)
    at Object.one [as handle] (/node_modules/zwitch/index.js:20:25)
    at flow (/node_modules/mdast-util-to-markdown/lib/util/container-flow.js:15:15)
    at Object.root (/node_modules/mdast-util-to-markdown/lib/handle/root.js:6:10)
    at Object.one [as handle] (/node_modules/zwitch/index.js:20:25)
    at toMarkdown (/node_modules/mdast-util-to-markdown/lib/index.js:38:20)
    at compile (/node_modules/remark-stringify/index.js:13:12)
    at Function.stringify (/node_modules/unified/index.js:354:12)
    at Object.<anonymous> (/test.ts:20:30)

Your environment

  • OS: Ubuntu
  • Packages: mdast-util-to-markdown 0.6.3
  • Env: node v15.5.1

Steps to reproduce

const remark = require('remark')
remark().processSync('<web-component>t')

Expected behavior

no error

Actual behavior

TypeError: Cannot read property 'replace' of undefined
    at phrasing (/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js:35:65)
    at Object.paragraph (/node_modules/mdast-util-to-markdown/lib/handle/paragraph.js:8:15)
    at Object.one [as handle] (/node_modules/zwitch/index.js:20:25)
    at flow (/node_modules/mdast-util-to-markdown/lib/util/container-flow.js:15:15)
    at Object.root (/node_modules/mdast-util-to-markdown/lib/handle/root.js:6:10)
    at Object.one [as handle] (/node_modules/zwitch/index.js:20:25)
    at toMarkdown (/node_modules/mdast-util-to-markdown/lib/index.js:38:20)
    at compile (/node_modules/remark-stringify/index.js:13:12)
    at Function.stringify (/node_modules/unified/index.js:354:12)
    at Object.<anonymous> (/test.ts:20:30)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions