Skip to content

Commit

Permalink
bugdown: Add explanation for unicode-emoji JS regex.
Browse files Browse the repository at this point in the history
  • Loading branch information
hackerkid authored and timabbott committed Nov 17, 2016
1 parent 3a8282f commit cdb716a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions zerver/lib/bugdown/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,12 @@ def extendMarkdown(self, md, md_globals):
md.inlinePatterns.add('unicodeemoji', UnicodeEmoji(
u'(?P<syntax>[\U0001F300-\U0001F64F\U0001F680-\U0001F6FF\u2600-\u26FF\u2700-\u27BF])'),
'_end')
# The equalent JS regex is \ud83c[\udf00-\udfff]|\ud83d[\udc00-\ude4f]|\ud83d[\ude80-\udeff]|
# [\u2600-\u26FF]|[\u2700-\u27BF]. See below comments for explanation. The JS regex is used
# by marked.js for frontend unicode emoji processing.
# The JS regex \ud83c[\udf00-\udfff]|\ud83d[\udc00-\ude4f] represents U0001F300-\U0001F64F
# The JS regex \ud83d[\ude80-\udeff] represents \U0001F680-\U0001F6FF
# Similiarly [\u2600-\u26FF]|[\u2700-\u27BF] represents \u2600-\u26FF\u2700-\u27BF

md.inlinePatterns.add('link', AtomicLinkPattern(markdown.inlinepatterns.LINK_RE, md), '>avatar')

Expand Down

0 comments on commit cdb716a

Please sign in to comment.