Skip to content

renderMarkdown drops a code span nested inside <del> #266

Description

@sandros94

Environment

  • os: Ubuntu 24
  • node: v24.17.0
  • pm: pnpm@11.9.0
  • framework: Agnostic

Comark Version

v0.5.0

Reproduction

import { parse } from 'comark'
import { renderMarkdown } from 'comark/render'

await renderMarkdown({ frontmatter: {}, meta: {}, nodes: [['p', {}, ['del', {}, ['code', {}, 'x']]]] })
// actual:   '~~x~~'
// expected: '~~`x`~~'

await renderMarkdown({ frontmatter: {}, meta: {}, nodes: [['p', {}, ['em', {}, ['code', {}, 'x']]]] })
// '*`x`*'   ← em>code is correct

await renderMarkdown(await parse('~~`x`~~'))
// '~~x~~'

Description

The del handler returns \${textContent(node)}`, flattening children instead of recursing — so nested inline nodes are lost. em` recurses and is fine.

I'll work on a PR as soon as I'm able to

Additional context

No response

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions