aboutsummaryrefslogtreecommitdiff
path: root/pages/post
diff options
context:
space:
mode:
authorlonkaars <l.leblansch@gmail.com>2021-03-30 14:54:22 +0200
committerlonkaars <l.leblansch@gmail.com>2021-03-30 14:54:22 +0200
commitf75e45311ff48d14aa28ae6899a13b26b751c005 (patch)
tree503923c32d552a814c89b50958bbf4ea65f8c52b /pages/post
parent8798e98cf0ebc3653366566ad6d114a021f5a757 (diff)
pinned posts on homepage working
Diffstat (limited to 'pages/post')
-rw-r--r--pages/post/[id].tsx20
1 files changed, 12 insertions, 8 deletions
diff --git a/pages/post/[id].tsx b/pages/post/[id].tsx
index 3144057..23ce14e 100644
--- a/pages/post/[id].tsx
+++ b/pages/post/[id].tsx
@@ -10,7 +10,7 @@ import Image from '../../components/image';
import Chapters, { chapter } from '../../components/chapters';
import Tags from '../../components/tag';
-interface ArticleMeta {
+export interface ArticleMeta {
title?: string;
subtitle?: string;
author?: string;
@@ -19,6 +19,16 @@ interface ArticleMeta {
chapters?: Array<chapter>;
}
+export function RenderedArticle(props: { content: string }) {
+ return <ReactMarkdown
+ children={props.content}
+ renderers={{
+ image: Image,
+ thematicBreak: Seperator,
+ heading: Heading,
+ }}/>;
+}
+
var headingLevel = (input: string) => input?.match(/^[#]+/)[0]?.length || 0;
var sectionID = (input: string) => input
@@ -52,13 +62,7 @@ export default function Post(props: {
</div>
</div>
<div className="contentWrapper">
- <ReactMarkdown
- children={props.content}
- renderers={{
- image: Image,
- thematicBreak: Seperator,
- heading: Heading,
- }}/>
+ <RenderedArticle content={props.content}/>
</div>
</div>
</div>