diff options
author | eug-vs <eug-vs@keemail.me> | 2020-04-05 22:16:02 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-04-05 22:16:18 +0300 |
commit | 43d65a56bbe91de967fa2ff86b25ec216bfd5ce1 (patch) | |
tree | 731e625b344ad493579e6af293986747d7519ebe /src | |
parent | 828946eb02bdfaa7ec5631f1e854881f874f7b7e (diff) | |
download | react-benzin-43d65a56bbe91de967fa2ff86b25ec216bfd5ce1.tar.gz |
style: fix linting errors :rotating_light:
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Markdown/Content.tsx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/Markdown/Content.tsx b/src/lib/Markdown/Content.tsx index caac91c..aaea100 100644 --- a/src/lib/Markdown/Content.tsx +++ b/src/lib/Markdown/Content.tsx @@ -24,7 +24,7 @@ const denotesClosingHtml= (line: string, tag: string): boolean => { return line.match(regex) !== null; } -const denotesSelfClosingHtml = (line: string): any => { +const denotesSelfClosingHtml = (line: string): string[] | null => { const regex = /(<[^/\s]*[^<]*\/>)/g; return line.match(regex); } @@ -44,14 +44,14 @@ const Content: React.FC<ParserPropTypes> = ({ rawLines }) => { const dottedListLines = rawLines.splice(0, closeIndex).slice(0, closeIndex); dottedListLines.unshift(line); buffer = <ul>{dottedListLines.map(li => <li><Text line={li.slice(2)} /></li>)}</ul>; - } else if (denotesOpenHtml(line)) { - const tag = denotesOpenHtml(line); + } else if ((buffer = denotesOpenHtml(line))) { + const tag = buffer; const closeIndex = rawLines.findIndex(line => denotesClosingHtml(line, tag)); const htmlLines = rawLines.splice(0, closeIndex + 1).slice(0, closeIndex); htmlLines.unshift(line); buffer = <div dangerouslySetInnerHTML={{ __html: htmlLines.join('\n') }}></div>; - } else if (denotesSelfClosingHtml(line) !== null) { - const match = denotesSelfClosingHtml(line)[0]; + } else if ((buffer = denotesSelfClosingHtml(line)) !== null) { + const match = buffer[0]; const [before, after] = line.split(match); console.log({ line, match, before, after}); buffer = ( |