noogle/website/components/markdownPreview/MarkdownPreview.tsx
Johannes Kirschbauer d9f579cf44
Feature/monorepo (#24)
* refactor to include all necessary dependencies directly here

* move indexer into monorepo

* add snapshot tests and seperate sub.project for builtin types

* add more missing builtins such as fromTOML
2023-02-25 13:14:40 +01:00

23 lines
534 B
TypeScript

import ReactMarkdown from "react-markdown";
import rehypeHighlight from "rehype-highlight";
import nix from "highlight.js/lib/languages/nix";
interface MarkdownPreviewProps {
description: string;
}
export const MarkdownPreview = (props: MarkdownPreviewProps) => {
const { description } = props;
return (
<ReactMarkdown
components={{
h1: "h3",
h2: "h4",
h3: "h5",
}}
rehypePlugins={[[rehypeHighlight, { languages: { nix } }]]}
>
{description}
</ReactMarkdown>
);
};