Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions components/code-block.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
'use client';

interface CodeBlockProps {
node: any;
inline: boolean;
className: string;
children: any;
node?: any;
className?: string;
children?: any;
}

export function CodeBlock({
node,
inline,
className,
children,
...props
}: CodeBlockProps) {
if (!inline) {
if (node?.children[0]?.value?.endsWith('\n')) {
return (
<div className="not-prose flex flex-col">
<pre
Expand Down
2 changes: 1 addition & 1 deletion components/markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import Link from 'next/link';
import React, { memo } from 'react';
import ReactMarkdown, { type Components } from 'react-markdown';
import remarkGfm from 'remark-gfm';

import { CodeBlock } from './code-block';

const components: Partial<Components> = {
// @ts-expect-error
code: CodeBlock,
pre: ({ children }) => <>{children}</>,
ol: ({ node, children, ...props }) => {
Expand Down