Skip to content

Commit

Permalink
Merge pull request #30 from diffplug/feat/code-blocks
Browse files Browse the repository at this point in the history
Style markdown code blocks
  • Loading branch information
WebsByTodd authored Oct 3, 2023
2 parents ca34d82 + e8114e7 commit beafe2e
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 378 deletions.
298 changes: 0 additions & 298 deletions docs/src/components/Code.jsx

This file was deleted.

58 changes: 0 additions & 58 deletions docs/src/components/Tag.jsx

This file was deleted.

21 changes: 19 additions & 2 deletions docs/src/components/mdx.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import clsx from "clsx";
export { CodeGroup, Code as code, Pre as pre } from "@/components/Code";

type ParentComponentProps = {
children: React.ReactNode;
children?: React.ReactNode;
};

export function Row({ children }: ParentComponentProps) {
Expand All @@ -29,3 +28,21 @@ export function Col({ children, sticky = false }: ColProps) {
</div>
);
}

export function code({ children, ...props }: ParentComponentProps) {
return children ? (
<code {...props} dangerouslySetInnerHTML={{ __html: children }} />
) : (
<code {...props} />
);
}

export function pre({ children, ...props }: ParentComponentProps) {
return (
<div className={clsx(["rounded-2xl", "bg-grey/60", "shadow", "text-base"])}>
<pre className="overflow-scroll p-4" {...props}>
{children}
</pre>
</div>
);
}
Loading

0 comments on commit beafe2e

Please sign in to comment.