File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -121,4 +121,20 @@ public void TestCustomEmojiValidation()
121121 smileyToEmoji . Add ( "a" , "c" ) ; // "a" already exists in emojiToUnicode
122122 Assert . Throws < ArgumentException > ( ( ) => new EmojiMapping ( emojiToUnicode , smileyToEmoji ) ) ;
123123 }
124+
125+ [ Test ]
126+ [ TestCase ( "|test|\n |-|\n |:x:|" , "<table>\n <thead>\n <tr>\n <th>test</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>❌</td>\n </tr>\n </tbody>\n </table>\n " ) ]
127+ [ TestCase ( "|test|\n |-|\n | :x: |" , "<table>\n <thead>\n <tr>\n <th>test</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>❌</td>\n </tr>\n </tbody>\n </table>\n " ) ]
128+ [ TestCase ( "|test|\n |-|\n |1:x:|" , "<table>\n <thead>\n <tr>\n <th>test</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>1:x:</td>\n </tr>\n </tbody>\n </table>\n " ) ]
129+ [ TestCase ( "|test|\n |-|\n |w:x:y|" , "<table>\n <thead>\n <tr>\n <th>test</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>w:x:y</td>\n </tr>\n </tbody>\n </table>\n " ) ]
130+ public void TestEmojiInPipeTable ( string input , string expected )
131+ {
132+ var pipeline = new MarkdownPipelineBuilder ( )
133+ . UseEmojiAndSmiley ( )
134+ . UsePipeTables ( )
135+ . Build ( ) ;
136+
137+ var actual = Markdown . ToHtml ( input , pipeline ) ;
138+ Assert . AreEqual ( expected , actual ) ;
139+ }
124140}
Original file line number Diff line number Diff line change @@ -29,8 +29,9 @@ public EmojiParser(EmojiMapping emojiMapping)
2929 /// </summary>
3030 public override bool Match ( InlineProcessor processor , ref StringSlice slice )
3131 {
32- // Previous char must be a space
33- if ( ! slice . PeekCharExtra ( - 1 ) . IsWhiteSpaceOrZero ( ) )
32+ // Previous char must be a space or non-alphanumeric.
33+ var prevChar = slice . PeekCharExtra ( - 1 ) ;
34+ if ( ! prevChar . IsWhiteSpaceOrZero ( ) && char . IsLetterOrDigit ( prevChar ) )
3435 {
3536 return false ;
3637 }
You can’t perform that action at this time.
0 commit comments