Skip to content

Emojis can cause broken result #68

Open
@craftzdog

Description

@craftzdog

Initial checklist

Affected package

mdast-util-to-markdown@2.1.2

Steps to reproduce

const mdast = {
  type: 'root',
  children: [
    {
      type: 'paragraph',
      children: [
        {
          type: 'text',
          value: '💡',
          position: {
            start: {
              line: 8,
              column: 10,
              offset: 113
            },
            end: {
              line: 8,
              column: 12,
              offset: 115
            }
          }
        },
        {
          type: 'strong',
          children: [
            {
              type: 'text',
              value: ' Some tex',
              position: {
                start: {
                  line: 8,
                  column: 20,
                  offset: 123
                },
                end: {
                  line: 8,
                  column: 29,
                  offset: 132
                }
              }
            }
          ],
          position: {
            start: {
              line: 8,
              column: 12,
              offset: 115
            },
            end: {
              line: 8,
              column: 38,
              offset: 141
            }
          }
        },
        {
          type: 'text',
          value: 't',
          position: {
            start: {
              line: 8,
              column: 38,
              offset: 141
            },
            end: {
              line: 8,
              column: 39,
              offset: 142
            }
          }
        }
      ],
      position: {
        start: {
          line: 8,
          column: 7,
          offset: 110
        },
        end: {
          line: 8,
          column: 43,
          offset: 146
        }
      }
    }
  ],
  position: {
    start: {
      line: 1,
      column: 1,
      offset: 0
    },
    end: {
      line: 12,
      column: 1,
      offset: 176
    }
  }
}
const md = toMarkdown(mdast)
console.log('md:', md)

Actual behavior

��** Some tex**t

Expected behavior

💡** Some tex**t

Runtime

node@23.6.1

Package manager

npm@10.9.2

Operating system

macOS Sequoia 15.3.1

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