Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
abcd3cfa
Unverified
Commit
abcd3cfa
authored
Nov 24, 2022
by
boojack
Committed by
GitHub
Nov 24, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add `Strikethrough` syntax (#557)
feat: add `Strikethrough` rule
parent
50d41c45
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
2 deletions
+22
-2
DoneList.ts
web/src/labs/marked/parser/DoneList.ts
+1
-1
Strikethrough.ts
web/src/labs/marked/parser/Strikethrough.ts
+19
-0
index.ts
web/src/labs/marked/parser/index.ts
+2
-1
No files found.
web/src/labs/marked/parser/DoneList.ts
View file @
abcd3cfa
import
{
inlineElementParserList
}
from
"."
;
import
{
marked
}
from
".."
;
export
const
DONE_LIST_REG
=
/^-
\[
x
\]
(
.+
)(\n?)
/
;
export
const
DONE_LIST_REG
=
/^-
\[
[
xX
]
\]
(
.+
)(\n?)
/
;
const
renderer
=
(
rawStr
:
string
):
string
=>
{
const
matchResult
=
rawStr
.
match
(
DONE_LIST_REG
);
...
...
web/src/labs/marked/parser/Strikethrough.ts
0 → 100644
View file @
abcd3cfa
import
{
marked
}
from
".."
;
export
const
STRIKETHROUGH_REG
=
/~~
(
.+
?)
~~/
;
const
renderer
=
(
rawStr
:
string
):
string
=>
{
const
matchResult
=
rawStr
.
match
(
STRIKETHROUGH_REG
);
if
(
!
matchResult
)
{
return
rawStr
;
}
const
parsedContent
=
marked
(
matchResult
[
1
],
[],
[]);
return
`<del>
${
parsedContent
}
</del>`
;
};
export
default
{
name
:
"Strikethrough"
,
regex
:
STRIKETHROUGH_REG
,
renderer
,
};
web/src/labs/marked/parser/index.ts
View file @
abcd3cfa
...
...
@@ -16,6 +16,7 @@ import Table from "./Table";
import
BoldEmphasis
from
"./BoldEmphasis"
;
import
Blockquote
from
"./Blockquote"
;
import
HorizontalRules
from
"./HorizontalRules"
;
import
Strikethrough
from
"./Strikethrough"
;
export
{
CODE_BLOCK_REG
}
from
"./CodeBlock"
;
export
{
TODO_LIST_REG
}
from
"./TodoList"
;
...
...
@@ -38,5 +39,5 @@ export const blockElementParserList = [
UnorderedList
,
Paragraph
,
];
export
const
inlineElementParserList
=
[
Image
,
BoldEmphasis
,
Bold
,
Emphasis
,
Link
,
InlineCode
,
PlainLink
,
Tag
,
PlainText
];
export
const
inlineElementParserList
=
[
Image
,
BoldEmphasis
,
Bold
,
Emphasis
,
Link
,
InlineCode
,
PlainLink
,
Strikethrough
,
Tag
,
PlainText
];
export
const
parserList
=
[...
blockElementParserList
,
...
inlineElementParserList
];
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment