aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-04-07 20:32:10 +0300
committereug-vs <eug-vs@keemail.me>2020-04-07 20:32:10 +0300
commit46f410699037824408daf7c035458ba7bd958d44 (patch)
tree960c947abf78ae1a3882ef5ea914b9a265cc6c3b /src/lib
parentc851a68e15daedb8dbe572ce5927a8e61254d4c9 (diff)
downloadreact-benzin-46f410699037824408daf7c035458ba7bd958d44.tar.gz
feat: include content before first header
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Markdown/Section.tsx7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/Markdown/Section.tsx b/src/lib/Markdown/Section.tsx
index 5ce8954..987b771 100644
--- a/src/lib/Markdown/Section.tsx
+++ b/src/lib/Markdown/Section.tsx
@@ -30,7 +30,12 @@ const Section: React.FC<PropTypes> = ({ rawLines, level = 0 }) => {
const deeperLevelIndex = rawLines.findIndex(line => line.match(`^#{${level + 1},} .*$`));
const rawContent = rawLines.splice(0, (deeperLevelIndex < 0) ? rawLines.length : deeperLevelIndex);
- if (!level) return <ChildrenSections rawLines={rawLines} level={getHeaderLevel(rawLines[0])}/>;
+ if (!level) return (
+ <>
+ <Content rawLines={rawContent} />
+ <ChildrenSections rawLines={rawLines} level={getHeaderLevel(rawLines[0])}/>
+ </>
+ )
const sectionName = rawContent.splice(0, 1)[0].slice(level).trim();
const deeperLevel = getHeaderLevel(rawLines[0]);