Skip to content

Emoji parsing should exclude URLs #1823

Closed

Description

@socsieng

Bug Report

Parsing of :emojis: should exclude URLs as this causes URLs in the following format render invalid HTML:

[link](https://link.com/:smile:/index)

Note that in my use case, I am also using other :emojis: so I can't set noEmoji: true in config.

Happy to contribute a fix if this bug is accepted.

Steps to reproduce

Example: https://codesandbox.io/s/brave-margulis-tw5t2b?file=/index.html

What is current behaviour

Invalid HTML is rendered:

<a alt="smile" src="https://github.githubassets.com/images/icons/emoji/smile.png" href="https://link.com/&lt;img class=">/index" target="_blank"  rel="noopener"&gt;link</a>

image

What is the expected behaviour

Rendered HTML should produce something like:

<a href="https://link.com/:smile:/index" target="_blank"  rel="noopener">link</a>

Other relevant information

  • Bug does still occur when all/other plugins are disabled?

  • Your OS: macOS

  • Node.js version:

  • npm/yarn version:

  • Browser version: Safari 15.5

  • Docsify version: 4

  • Docsify plugins:

Please create a reproducible sandbox

Edit 307qqv236

Mention the docsify version in which this bug was not present (if any)

Activity

  1. sy-records commented on Jun 25, 2022

    @sy-records
    Member

    Thank you for your feedback.

    Have you tried #1746?

  2. socsieng commented on Jul 5, 2022

    @socsieng
    ContributorAuthor

    I've tried with nativeEmoji: true and it still suffers from the same problem: https://codesandbox.io/s/practical-borg-nb3vdl?file=/index.html

  3. jhildenbiddle commented on Jul 30, 2022

    @jhildenbiddle
    Member

    @socsieng --

    Ideally, docsify should handle this for you. If you're up for creating the PR, that would be great as I'm not sure I'll have the bandwidth anytime soon.

    If you need a quick fix, you can just manually encode any portion of a URL that requires it (like a string matching the double-colon emoji pattern). You can do this using an online encode/decode tool or with the console in your browser's dev tools:

    encodeURIComponent(':smile:')
    [link](https://link.com/%3Asmile%3A/index)
  4. added a commit that references this issue on Jul 30, 2022
    21aec01
  5. added a commit that references this issue on Aug 3, 2022
    3c9b3d9
  6. added 2 commits that reference this issue on Oct 26, 2022
    8537f24
    ff2cb0f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions