xoofx / markdig

A fast, powerful, CommonMark compliant, extensible Markdown processor for .NET
BSD 2-Clause "Simplified" License
4.32k stars 448 forks source link

Emojis don't get converted at the start of links #768

Open Flayms opened 8 months ago

Flayms commented 8 months ago

With the following code

using Markdig;

var markdown = "[:clap: a link :clap:](https://github.com/xoofx/markdig)";

var pipeline = new MarkdownPipelineBuilder()
    .UseEmojiAndSmiley()
    .Build();

var html = Markdown.ToHtml(markdown, pipeline);

I am getting the following output:

<p><a href="https://github.com/xoofx/markdig">:clap: a link 👏</a></p>

I believe the first emoji should be converted as well.

Scooletz commented 6 months ago

This is probably due to: https://github.com/xoofx/markdig/blob/391f376fa22b87494e308091d1b27be83e82f567/src/Markdig/Extensions/Emoji/EmojiParser.cs#L29-L33

The question is whether it's aligned to the spec that requires a space before an emoji https://github.com/xoofx/markdig/blob/master/src/Markdig.Tests/Specs/EmojiSpecs.md