Skip to content

The image link has an extra \ added during the conversion process #64

@hyoban

Description

@hyoban

Initial checklist

  • I read the support docs
    I read the contributing guide
    I agree to follow the code of conduct
    I searched issues and couldn’t find anything (or linked relevant results below)

Affected packages and versions

2.1.2

Link to runnable example

https://codesandbox.io/p/sandbox/remark-debug-formatted-autolink-simple-forked-mhn96l

Steps to reproduce

const sourceMarkdown =
  "![](https://image-proxy.zslren.com/img-proxy/?k=3507a87d&u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2Ftc9Zic7wWc9BZCDeUpBKjNhykdf3v3OKrGjF1mYlX8BEm3zCWWkhMH4S362huEz93Dz9qqIhJHmH4aLqiaOQa2jQ%2F0%3Fwx_fmt%3Djpeg)";

const mdast = remark().parse(sourceMarkdown);
const contents = toMarkdown(mdast);

Expected behavior

The image link should be

https://image-proxy.zslren.com/img-proxy/?k=3507a87d&u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2Ftc9Zic7wWc9BZCDeUpBKjNhykdf3v3OKrGjF1mYlX8BEm3zCWWkhMH4S362huEz93Dz9qqIhJHmH4aLqiaOQa2jQ%2F0%3Fwx_fmt%3Djpeg

Actual behavior

The image link is

https://image-proxy.zslren.com/img-proxy/?k=3507a87d\&u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2Ftc9Zic7wWc9BZCDeUpBKjNhykdf3v3OKrGjF1mYlX8BEm3zCWWkhMH4S362huEz93Dz9qqIhJHmH4aLqiaOQa2jQ%2F0%3Fwx_fmt%3Djpeg

An extra \ appears before &u=, causing the image to not be displayed correctly.

Affected runtime and version

node@22.11.0

Affected package manager and version

No response

Affected OS and version

No response

Build and bundle tools

No response

Activity

added
👋 phase/newPost is being triaged automatically
🤞 phase/openPost is being triaged manually
and removed
👋 phase/newPost is being triaged automatically
on Nov 11, 2024
wooorm

wooorm commented on Nov 11, 2024

@wooorm
Member

causing the image to not be displayed correctly.

If that happens, that is a bug in the tools you are using. You can raise problems with the tools you are using to preview/render markdown, with those tools themselves.

In markdown, that slash is allowed there.
In markdown, it’s good to have that slash there.

github-actions

github-actions commented on Nov 11, 2024

@github-actions
added
👎 phase/noPost cannot or will not be acted on
and removed
🤞 phase/openPost is being triaged manually
on Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    👀 no/externalThis makes more sense somewhere else👎 phase/noPost cannot or will not be acted on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @wooorm@hyoban

        Issue actions

          The image link has an extra \ added during the conversion process · Issue #64 · syntax-tree/mdast-util-to-markdown