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
1847756a
Unverified
Commit
1847756a
authored
Jan 07, 2023
by
boojack
Committed by
GitHub
Jan 07, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: remove escape (#918)
parent
771c56f4
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
15 additions
and
25 deletions
+15
-25
Blockquote.tsx
web/src/labs/marked/parser/Blockquote.tsx
+1
-2
CodeBlock.tsx
web/src/labs/marked/parser/CodeBlock.tsx
+1
-2
Heading.tsx
web/src/labs/marked/parser/Heading.tsx
+5
-6
Image.tsx
web/src/labs/marked/parser/Image.tsx
+1
-2
InlineCode.tsx
web/src/labs/marked/parser/InlineCode.tsx
+1
-2
Link.tsx
web/src/labs/marked/parser/Link.tsx
+1
-2
PlainLink.tsx
web/src/labs/marked/parser/PlainLink.tsx
+2
-3
PlainText.tsx
web/src/labs/marked/parser/PlainText.tsx
+1
-2
Strikethrough.tsx
web/src/labs/marked/parser/Strikethrough.tsx
+1
-2
Tag.tsx
web/src/labs/marked/parser/Tag.tsx
+1
-2
No files found.
web/src/labs/marked/parser/Blockquote.tsx
View file @
1847756a
import
{
escape
}
from
"lodash"
;
import
{
matcher
}
from
"../matcher"
;
export
const
BLOCKQUOTE_REG
=
/^>
([^\n]
+
)
/
;
...
...
@@ -9,7 +8,7 @@ const renderer = (rawStr: string) => {
return
<>
{
rawStr
}
</>;
}
return
<
blockquote
>
{
escape
(
matchResult
[
1
])
}
</
blockquote
>;
return
<
blockquote
>
{
matchResult
[
1
]
}
</
blockquote
>;
};
export
default
{
...
...
web/src/labs/marked/parser/CodeBlock.tsx
View file @
1847756a
import
copy
from
"copy-to-clipboard"
;
import
{
escape
}
from
"lodash-es"
;
import
hljs
from
"highlight.js"
;
import
{
useTranslation
}
from
"react-i18next"
;
import
{
matcher
}
from
"../matcher"
;
...
...
@@ -14,7 +13,7 @@ const renderer = (rawStr: string) => {
return
<>
{
rawStr
}
</>;
}
const
language
=
escape
(
matchResult
[
1
])
||
"plaintext"
;
const
language
=
matchResult
[
1
]
||
"plaintext"
;
let
highlightedCode
=
hljs
.
highlightAuto
(
matchResult
[
2
]).
value
;
try
{
...
...
web/src/labs/marked/parser/Heading.tsx
View file @
1847756a
import
{
escape
}
from
"lodash"
;
import
{
matcher
}
from
"../matcher"
;
export
const
HEADING_REG
=
/^
(
#+
)
([^\n]
+
)
/
;
...
...
@@ -11,15 +10,15 @@ const renderer = (rawStr: string) => {
const
level
=
matchResult
[
1
].
length
;
if
(
level
===
1
)
{
return
<
h1
>
{
escape
(
matchResult
[
2
])
}
</
h1
>;
return
<
h1
>
{
matchResult
[
2
]
}
</
h1
>;
}
else
if
(
level
===
2
)
{
return
<
h2
>
{
escape
(
matchResult
[
2
])
}
</
h2
>;
return
<
h2
>
{
matchResult
[
2
]
}
</
h2
>;
}
else
if
(
level
===
3
)
{
return
<
h3
>
{
escape
(
matchResult
[
2
])
}
</
h3
>;
return
<
h3
>
{
matchResult
[
2
]
}
</
h3
>;
}
else
if
(
level
===
4
)
{
return
<
h4
>
{
escape
(
matchResult
[
2
])
}
</
h4
>;
return
<
h4
>
{
matchResult
[
2
]
}
</
h4
>;
}
return
<
h5
>
{
escape
(
matchResult
[
2
])
}
</
h5
>;
return
<
h5
>
{
matchResult
[
2
]
}
</
h5
>;
};
export
default
{
...
...
web/src/labs/marked/parser/Image.tsx
View file @
1847756a
import
{
escape
}
from
"lodash-es"
;
import
{
absolutifyLink
}
from
"../../../helpers/utils"
;
import
{
matcher
}
from
"../matcher"
;
...
...
@@ -10,7 +9,7 @@ const renderer = (rawStr: string) => {
return
rawStr
;
}
const
imageUrl
=
absolutifyLink
(
escape
(
matchResult
[
1
])
);
const
imageUrl
=
absolutifyLink
(
matchResult
[
1
]
);
return
<
img
className=
"img"
src=
{
imageUrl
}
/>;
};
...
...
web/src/labs/marked/parser/InlineCode.tsx
View file @
1847756a
import
{
escape
}
from
"lodash-es"
;
import
{
matcher
}
from
"../matcher"
;
export
const
INLINE_CODE_REG
=
/`
(
.+
?)
`/
;
...
...
@@ -9,7 +8,7 @@ const renderer = (rawStr: string) => {
return
rawStr
;
}
return
<
code
>
{
escape
(
matchResult
[
1
])
}
</
code
>;
return
<
code
>
{
matchResult
[
1
]
}
</
code
>;
};
export
default
{
...
...
web/src/labs/marked/parser/Link.tsx
View file @
1847756a
import
{
escape
}
from
"lodash-es"
;
import
Emphasis
from
"./Emphasis"
;
import
Bold
from
"./Bold"
;
import
{
marked
}
from
".."
;
...
...
@@ -16,7 +15,7 @@ const renderer = (rawStr: string) => {
}
const
parsedContent
=
marked
(
matchResult
[
1
],
[],
[
InlineCode
,
BoldEmphasis
,
Emphasis
,
Bold
,
PlainText
]);
return
(
<
a
className=
"link"
target=
"_blank"
rel=
"noreferrer"
href=
{
escape
(
matchResult
[
2
])
}
>
<
a
className=
"link"
target=
"_blank"
rel=
"noreferrer"
href=
{
matchResult
[
2
]
}
>
{
parsedContent
}
</
a
>
);
...
...
web/src/labs/marked/parser/PlainLink.tsx
View file @
1847756a
import
{
escape
}
from
"lodash-es"
;
import
{
matcher
}
from
"../matcher"
;
export
const
PLAIN_LINK_REG
=
/
(
https
?
:
\/\/[^
]
+
)
/
;
...
...
@@ -10,8 +9,8 @@ const renderer = (rawStr: string) => {
}
return
(
<
a
className=
"link"
target=
"_blank"
rel=
"noreferrer"
href=
{
escape
(
matchResult
[
1
])
}
>
{
escape
(
matchResult
[
1
])
}
<
a
className=
"link"
target=
"_blank"
rel=
"noreferrer"
href=
{
matchResult
[
1
]
}
>
{
matchResult
[
1
]
}
</
a
>
);
};
...
...
web/src/labs/marked/parser/PlainText.tsx
View file @
1847756a
import
{
escape
}
from
"lodash-es"
;
import
{
matcher
}
from
"../matcher"
;
export
const
PLAIN_TEXT_REG
=
/
(
.+
)
/
;
...
...
@@ -9,7 +8,7 @@ const renderer = (rawStr: string): string => {
return
rawStr
;
}
return
`
${
escape
(
matchResult
[
1
])}
`
;
return
matchResult
[
1
]
;
};
export
default
{
...
...
web/src/labs/marked/parser/Strikethrough.tsx
View file @
1847756a
import
{
escape
}
from
"lodash"
;
import
{
matcher
}
from
"../matcher"
;
export
const
STRIKETHROUGH_REG
=
/~~
(
.+
?)
~~/
;
...
...
@@ -9,7 +8,7 @@ const renderer = (rawStr: string) => {
return
rawStr
;
}
return
<
del
>
{
escape
(
matchResult
[
1
])
}
</
del
>;
return
<
del
>
{
matchResult
[
1
]
}
</
del
>;
};
export
default
{
...
...
web/src/labs/marked/parser/Tag.tsx
View file @
1847756a
import
{
escape
}
from
"lodash-es"
;
import
{
matcher
}
from
"../matcher"
;
export
const
TAG_REG
=
/#
([^\s
#
]
+
)
/
;
...
...
@@ -9,7 +8,7 @@ const renderer = (rawStr: string) => {
return
rawStr
;
}
return
<
span
className=
"tag-span"
>
#
{
escape
(
matchResult
[
1
])
}
</
span
>;
return
<
span
className=
"tag-span"
>
#
{
matchResult
[
1
]
}
</
span
>;
};
export
default
{
...
...
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