Emoji support in profile (#3514)

* Emoji in profile

* Add emojis to fields
This commit is contained in:
MeiMei 2018-12-06 10:02:04 +09:00 committed by syuilo
parent fe891da886
commit 4522568749
41 changed files with 261 additions and 70 deletions

View file

@ -64,6 +64,29 @@ const newline = P((input, i) => {
}
});
export const plainParser = P.createLanguage({
root: r => P.alt(
r.emoji,
r.text
).atLeast(1),
text: () => P.any.map(x => makeNode('text', { text: x })),
//#region Emoji
emoji: r =>
P.alt(
P.regexp(/:([a-z0-9_+-]+):/i, 1)
.map(x => makeNode('emoji', {
name: x
})),
P.regexp(emojiRegex)
.map(x => makeNode('emoji', {
emoji: x
})),
),
//#endregion
});
const mfm = P.createLanguage({
root: r => P.alt(
r.big,