Skip to content

Emoji parser does not discriminate #2352

Closed

Description

@luckman212

Describe the bug

After emoji parsing was added (#1816) there are unintended side effects when :xxx: substrings are contained within README's.

$ gh --version
gh version 1.2.0 (2020-10-27)

Steps to reproduce the behavior

Type e.g. gh repo view strongswan/strongswan and note the German flag in the middle...

image

from strongswan/README.md:

image

Activity

  1. added
    bug
    on Nov 3, 2020
  2. added
    priority-3
    help wanted
    on Nov 4, 2020
  3. divyaramanathan commented on Nov 6, 2020

    @divyaramanathan
    Contributor

    Hi there! Is this issue still open? I might be interested in taking a deeper look at this; does your team have any resources or tips you'd recommend to get started? Thanks!

  4. samcoe commented on Nov 6, 2020

    @samcoe
    Contributor

    @divyaramanathan This issue is still open and available to be worked on. We are using https://github.com/charmbracelet/glamour to parse our markdown right now, which in turn uses https://github.com/yuin/goldmark. The goldmark library already has an emoji extension (https://github.com/yuin/goldmark-emoji) that we should try to use. I think the difficult part is just figuring out how to get that extension working with glamour.

  5. zaboyle commented on Nov 7, 2020

    @zaboyle
    Contributor

    @samcoe Hi, I'm working on this issue with @divyaramanathan, and we wanted to confirm the correct behavior for this defect. We've found this repo that uses emojis as well as plaintext following the :word: format. We think the correct behavior would be to not render emojis in code blocks. This would reflect behavior on the Github website. Are we on the right track with this idea? thanks!

  6. samcoe commented on Nov 9, 2020

    @samcoe
    Contributor

    @zaboyle That is correct, we want to keep the same behavior that we see on GitHub which would be not rendering emoji in code blocks. Also, it seems that the goldmark-emoji extension I linked above already has the GitHub emoji definitions (https://github.com/yuin/goldmark-emoji/blob/master/definition/github.go) so I would expect that to work as is without having to introduce another library for those definitions.

  7. zaboyle commented on Nov 12, 2020

    @zaboyle
    Contributor

    @samcoe me and @divyaramanathan are currently toying with goldmark-emoji. We were able add the dependency and modify the rendering of the :de: in the strongswan/strongswan README
    from the original
    image

    to
    image

    We think this is still incorrect because it seems the goldmark-emoji parser is still trying to render this :de: as an emoji. We're unsure of where to go from here (maybe dig into some of the glamour internals?), and would appreciate any advice you may have!

    We can make a draft PR with our current changes if you'd like!

    Thanks!

  8. divyaramanathan commented on Nov 12, 2020

    @divyaramanathan
    Contributor

    Just to add on to what @zaboyle said, 🇩 is the Unicode hex character code for 'd' and then 🇪 is the Unicode hex character code for 'e'.

    I believe we are very close-- do you think this could relate to the type of terminal we're running on?

  9. samcoe commented on Nov 13, 2020

    @samcoe
    Contributor

    @zaboyle @divyaramanathan It seems unlikely that it is related to the terminal you are running. I think it would be easiest to open a draft PR so that I can better help with resolving this issue.

  10. self-assigned this
    on Nov 22, 2020
  11. mislav commented on Nov 24, 2020

    @mislav
    Contributor

    @divyaramanathan @zaboyle Thanks for taking a stab at this! It's a hard problem, and I don't think the libraries that we're using now are equipped well for extensibility.

    @samcoe Thank you for submitting the feature upstream! charmbracelet/glamour#92

    Since our current :emoji: substitution is broken (i.e. it replaces emoji where it shouldn't, such as in code blocks), would we consider reverting it until a better solution lands in Glamour?

  12. samcoe commented on Nov 25, 2020

    @samcoe
    Contributor

    I don't have a strong opinion here. I am comfortable leaving it as is, with some incorrect replacements, until the upstream PR gets merged. If more issues get opened regarding this bug or more people chime in saying they are encountering it then we could reevaluate and revert the change then.

  13. garvit-joshi commented on Dec 8, 2020

    @garvit-joshi

    I am not sure if this should be mentioned here, but some emojis are not working in Command Prompt.
    gitcli
    The Tick emoji(✓) to be precise.

  14. samcoe commented on Dec 8, 2020

    @samcoe
    Contributor

    A quick update here. The upstream PR charmbracelet/glamour#92 was merged in 🎉! Now we just need to wait for the next release of glamour.

    @garvit-joshi That is interesting. This issue is specifically for emoji rendering in our markdown renderer, where as it appears you are having rendering issues in our survey code. I think it would be best to keep these separate, so if you wouldn't mind opening a new issue that would be much appreciated.

  15. cristiand391 commented on Apr 11, 2021

    @cristiand391
    Contributor
  16. luckman212 commented on Apr 15, 2021

    @luckman212
    Author

    awesome @samcoe - thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bughelp wantedpriority-3

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions