Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sfm-js
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TransFem.org
sfm-js
Commits
73168960
Commit
73168960
authored
4 years ago
by
marihachi
Browse files
Options
Downloads
Patches
Plain Diff
wip
parent
7e05b755
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/parser/core-parser.pegjs
+41
-22
41 additions, 22 deletions
src/parser/core-parser.pegjs
with
41 additions
and
22 deletions
src/parser/core-parser.pegjs
+
41
−
22
View file @
73168960
...
@@ -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-z
A-Z
0-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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment