markdown-it / markdown-it-emoji

Emoji syntax plugin for markdown-it markdown parser
https://markdown-it.github.io/
MIT License
719 stars 167 forks source link

linkify + emoji fails #4

Closed jonathanong closed 8 years ago

jonathanong commented 9 years ago

test case:

'use strict';

var assert = require('assert');

var md = require('markdown-it')({
  linkify: true
});

md.use(require('markdown-it-emoji'));

describe('Linkify', function () {
  it('should linkify URLs', function () {
    var html = md.render('https://github.com');
    assert.equal(html.trim(), '<p><a href="https://github.com">https://github.com</a></p>');
  });
});

result:

<p><a href=\"https://github.com\">https❓/github.com</a></p>
puzrin commented 9 years ago

Ups... https://github.com/markdown-it/markdown-it-emoji/blob/master/lib/data/shortcuts.js#L18 this rule conflicts with :// in http.

Seems the most simple solution is to remove it. Agree?

jonathanong commented 9 years ago

totally up to you. IMO emojis are only valid if surrounded by \W but that's just me. ideally we wouldn't remove support for any emojis though ;)

puzrin commented 9 years ago

Ok, i will remove it now, to fix fuckup, and then is will be time to think how to improve logic. \W will work for english, but not for unicode.

Take a fresh look on that link please. Do you see any more conflicting cases?

jonathanong commented 9 years ago

nope, as long as you're not parsing inside code blocks.

puzrin commented 9 years ago

Published "fixed" version & created #5 to clarify logic (if it's beeded)

crookedneighbor commented 8 years ago

This also fails for urls that include emoji like shortcuts in them. For instance:

The URL in the message is http://habitica.wikia.com/wiki/Special:Preferences but it displays as http://habitica.wikia.com/wiki/Special😛references

puzrin commented 8 years ago

Fixed by https://github.com/markdown-it/markdown-it-emoji/commit/79fe7293850abd63f61e5e96192ce8247937b347

cunisia commented 4 years ago

Hello there,

First of al, thanks you very much for taking care of this library, it's very useful 😃

I managed to reproduce this bug with Sharepoint URL: https://morningtrans.sharepoint.com/:x:/r/quality/Shared%20Documents/...?d=w119ebfd3d2ee4dea8d7f047b6db59315&csf=1&e=GZRLy

It is displayed as: https://morningtrans.sharepoint.com/ ❌/r/quality/Shared%20Documents/...?d=w119ebfd3d2ee4dea8d7f047b6db59315&csf=1&e=GZRLy

I have no workaround so far, do you guys have any idea of the "fixability" of this bug?