aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Markdown/Markdown.tsx
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-04-18 20:44:55 +0300
committereug-vs <eug-vs@keemail.me>2020-04-18 20:44:55 +0300
commit9272b0af3d7b2fba4738a341a1f2776243e0e515 (patch)
treea0c315933d53e87614e806ba0b151234fb400977 /src/lib/Markdown/Markdown.tsx
parent2c5fa193541eb8b74974731d01312f73951bca17 (diff)
downloadreact-benzin-9272b0af3d7b2fba4738a341a1f2776243e0e515.tar.gz
style: manually fix some errors
Diffstat (limited to 'src/lib/Markdown/Markdown.tsx')
-rw-r--r--src/lib/Markdown/Markdown.tsx11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/Markdown/Markdown.tsx b/src/lib/Markdown/Markdown.tsx
index 68967c5..cfcf117 100644
--- a/src/lib/Markdown/Markdown.tsx
+++ b/src/lib/Markdown/Markdown.tsx
@@ -8,10 +8,13 @@ interface PropTypes {
url?: string;
}
-const resolveUrls = (line: string, baseUrl: string): string => {
- return line.replace(/src="(?!http)(.*)"[\s>]/, (match, url, offset, string) => `src="${baseUrl}/${url}?sanitize=true"`)
- .replace(/\[(.*\]?.*)\]\((?!http)(.+?)\)/, (match, text, url, offset, string) => `[${text}](${baseUrl}/${url})`);
-};
+const resolveUrls = (line: string, baseUrl: string): string => line.replace(
+ /src="(?!http)(.*)"[\s>]/,
+ (match, url) => `src="${baseUrl}/${url}?sanitize=true"`,
+).replace(
+ /\[(.*\]?.*)\]\((?!http)(.+?)\)/,
+ (match, text, url) => `[${text}](${baseUrl}/${url})`,
+);
const Markdown: React.FC<PropTypes> = ({ data, url }) => {
const [markdown, setMarkdown] = useState<string>(data || '');