mirror of
https://github.com/yusufipk/teknolojirehberleri.xyz.git
synced 2026-09-11 10:56:08 +00:00
markdown renderlamak için marked kütüphanesi eklendi.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import Head from "next/head";
|
||||
import { createClient } from "contentful";
|
||||
import ReactMarkdown from "react-markdown";
|
||||
import marked from "marked";
|
||||
|
||||
export default function PostDetails({ posts }) {
|
||||
if (!posts)
|
||||
@@ -14,6 +15,10 @@ export default function PostDetails({ posts }) {
|
||||
);
|
||||
|
||||
const { title, rehber, description } = posts.fields;
|
||||
function createMarkup() {
|
||||
return { __html: marked(rehber) };
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="markdown">
|
||||
<Head>
|
||||
@@ -22,7 +27,7 @@ export default function PostDetails({ posts }) {
|
||||
<meta property="og:title" content={`${title} - Teknoloji Rehberleri`} />
|
||||
<meta property="og:description" content={description} />
|
||||
</Head>
|
||||
<ReactMarkdown>{rehber}</ReactMarkdown>
|
||||
<div dangerouslySetInnerHTML={createMarkup()} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user