aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-04-07 15:31:00 +0300
committereug-vs <eug-vs@keemail.me>2020-04-07 15:31:00 +0300
commit5c259810433be8cdbe6fcac8776cdbf4a0c244b0 (patch)
tree2f9e1ba87aba5740ed913457861c6f6c1f52d09c /src
parent400330fe5ebd6951a97f07b6147b3af6113e034f (diff)
downloadreact-benzin-5c259810433be8cdbe6fcac8776cdbf4a0c244b0.tar.gz
fix: account for \r line endings, remove consoles
Diffstat (limited to 'src')
-rw-r--r--src/lib/Markdown/Content.tsx6
-rw-r--r--src/lib/Markdown/Markdown.tsx2
-rw-r--r--src/lib/Markdown/SyntacticSpan.tsx1
3 files changed, 3 insertions, 6 deletions
diff --git a/src/lib/Markdown/Content.tsx b/src/lib/Markdown/Content.tsx
index aaea100..30f2a8a 100644
--- a/src/lib/Markdown/Content.tsx
+++ b/src/lib/Markdown/Content.tsx
@@ -6,11 +6,10 @@ import { ParserPropTypes } from './types';
const denotesCodeBlock = (line: string): boolean => {
- return line.match(/^```.*$/) !== null;
-}
+ return line.match(/^\s*```.*$/) !== null; }
const denotesDottedList = (line: string): boolean => {
- return line.match(/^ ?- .*$/) !== null;
+ return line.match(/^ ?[-*] .*$/) !== null;
}
const denotesOpenHtml= (line: string): string => {
@@ -53,7 +52,6 @@ const Content: React.FC<ParserPropTypes> = ({ rawLines }) => {
} else if ((buffer = denotesSelfClosingHtml(line)) !== null) {
const match = buffer[0];
const [before, after] = line.split(match);
- console.log({ line, match, before, after});
buffer = (
<>
<Text line={before} />
diff --git a/src/lib/Markdown/Markdown.tsx b/src/lib/Markdown/Markdown.tsx
index 09ad54a..0a71fd3 100644
--- a/src/lib/Markdown/Markdown.tsx
+++ b/src/lib/Markdown/Markdown.tsx
@@ -16,7 +16,7 @@ const Markdown: React.FC<PropTypes> = ({ data, url }) => {
}, [data, url]);
if (url) axios.get(url).then(response => setMarkdown(response.data));
- return <Section rawLines={markdown.split('\n')} />
+ return <Section rawLines={markdown.split(/\r?\n/)} />
};
diff --git a/src/lib/Markdown/SyntacticSpan.tsx b/src/lib/Markdown/SyntacticSpan.tsx
index 299bf87..7fd9bc5 100644
--- a/src/lib/Markdown/SyntacticSpan.tsx
+++ b/src/lib/Markdown/SyntacticSpan.tsx
@@ -42,7 +42,6 @@ const splitter = new RegExp(Object.values(regex).map(pair => pair.global.source)
const emojiList: Emoji[] = [];
Object.keys(emojiLib).forEach(name => emojiList.push({ name, char: emojiLib[name].char }));
-console.log({emojiList})
const useStyles = makeStyles(theme => ({
code: {