Skip to content

Needless escapes in Markdown since 2.1.1 #66

Closed as not planned
Closed as not planned
@kawanet

Description

@kawanet

Initial checklist

Affected packages and versions

mdast-util-to-markdown

Link to runnable example

No response

Steps to reproduce

import {fromMarkdown} from 'mdast-util-from-markdown'
import {toMarkdown} from 'mdast-util-to-markdown'
import {toHast} from 'mdast-util-to-hast'
import {toHtml} from 'hast-util-to-html'

const md = `foo***bar***buz`;
console.log(md) // original
console.log(toMarkdown(fromMarkdown(md))) // round trip
console.log(toHtml(toHast(fromMarkdown(md)))) // HTML

Expected behavior

until mdast-util-to-markdown version 2.1.0, or commit df0d6a6, it works correctly.
toMarkdown(fromMarkdown(md)) runs the round trip from Markdown to Markdown.

foo***bar***buz
foo***bar***buz
<p>foo<em><strong>bar</strong></em>buz</p>

Actual behavior

since mdast-util-to-markdown version 2.1.1, or commit 97fb818, it made characters escaped needlessly just before and after both * and **.
toMarkdown(fromMarkdown(md)) cannot run the round trip from Markdown to Markdown.
toHtml(toHast(fromMarkdown(md))) still has no trouble on the other hand.

foo***bar***buz
fo&#x6F;***bar***&#x62;uz
<p>foo<em><strong>bar</strong></em>buz</p>

It means version 2.1.1 has a breaking change. Version 2.1.2 has the same issue.
Thank you maintaining this anyway.

Affected runtime and version

[email protected]

Affected package manager and version

No response

Affected OS and version

No response

Build and bundle tools

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions