Skip to content

Code with // comments pasted inside code blocks is incorrectly recognized as links #4613

@leeyiding

Description

@leeyiding

Description

When pasting code into a code block in plate.js, any code snippet that contains // comments is incorrectly recognized and rendered as links.

Expected behavior: content inside a code block should only be highlighted according to syntax highlighting rules, without applying any Markdown formatting such as links.

This bug makes code snippets unreadable and breaks the expected behavior of code blocks.

Reproduction URL

No response

Reproduction steps

1. Insert a code block.
2. Paste the following snippet (or any other code):

// this is a comment
console.log("hello world");

3. Actual result: the entire pasted code (starting from //) is rendered as links.
4. Expected result: the code should remain plain code with syntax highlighting, without being transformed into links.

Plate version

49.0.0

Slate React version

0.117.0

Screenshots

Logs

Browsers

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions