Skip to content
Snippets Groups Projects
Commit 73168960 authored by marihachi's avatar marihachi
Browse files

wip

parent 7e05b755
No related branches found
No related tags found
No related merge requests found
...@@ -162,12 +162,34 @@ inline ...@@ -162,12 +162,34 @@ inline
/ big / big
/ bold / bold
/ small / small
/ italic
/ strike / strike
/ inlineCode / inlineCode
/ mathInline / mathInline
/ hashtag / hashtag
/ text / text
// inline: emoji
emoji
= customEmoji / unicodeEmoji
customEmoji
= ":" name:emojiName ":"
{
return createNode('emoji', { name: name });
}
emojiName
= [a-z0-9_+-]i+ { return text(); }
// NOTE: if the text matches one of the emojis, it will count the length of the emoji sequence and consume it.
unicodeEmoji
= &{ return matchUnicodeEmoji(); } (&{ return forwardUnicodeEmoji(); } .)+
{
return createNode('emoji', { emoji: text() });
}
// inline: big // inline: big
big big
...@@ -186,7 +208,7 @@ bold ...@@ -186,7 +208,7 @@ bold
{ {
return createNode('bold', { }, mergeText(content)); return createNode('bold', { }, mergeText(content));
} }
/ "__" content:$(!"__" c:[a-zA-Z0-9 \t] { return c; })+ "__" / "__" content:$(!"__" c:[a-z0-9 \t]i { return c; })+ "__"
{ {
const parsedContent = applyParser(content, 'inlineParser'); const parsedContent = applyParser(content, 'inlineParser');
return createNode('bold', { }, parsedContent); return createNode('bold', { }, parsedContent);
...@@ -208,6 +230,24 @@ strike ...@@ -208,6 +230,24 @@ strike
return createNode('strike', { }, mergeText(content)); return createNode('strike', { }, mergeText(content));
} }
// inline: italic
italic
= "<i>" content:(!"</i>" i:inline { return i; })+ "</i>"
{
return createNode('italic', { }, mergeText(content));
}
/ "*" content:$(!"*" [a-z0-9 \t]i)+ "*"
{
const parsedContent = applyParser(content, 'inlineParser');
return createNode('italic', { }, parsedContent);
}
/ "_" content:$(!"_" [a-z0-9 \t]i)+ "_"
{
const parsedContent = applyParser(content, 'inlineParser');
return createNode('italic', { }, parsedContent);
}
// inline: inlineCode // inline: inlineCode
inlineCode inlineCode
...@@ -247,27 +287,6 @@ hashtagBracketPair ...@@ -247,27 +287,6 @@ hashtagBracketPair
hashtagChar hashtagChar
= ![ \t.,!?'"#:\/\[\]【】()「」] CHAR = ![ \t.,!?'"#:\/\[\]【】()「」] CHAR
// inline: emoji
emoji
= customEmoji / unicodeEmoji
customEmoji
= ":" name:emojiName ":"
{
return createNode('emoji', { name: name });
}
emojiName
= [a-z0-9_+-]i+ { return text(); }
// NOTE: if the text matches one of the emojis, it will count the length of the emoji sequence and consume it.
unicodeEmoji
= &{ return matchUnicodeEmoji(); } (&{ return forwardUnicodeEmoji(); } .)+
{
return createNode('emoji', { emoji: text() });
}
// inline: text // inline: text
text text
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment