mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-16 01:01:38 +00:00
add copy button to gist code
update old post
This commit is contained in:
@ -1,14 +1,15 @@
|
||||
import '@catppuccin/highlightjs/sass/catppuccin.variables.scss';
|
||||
import clsx from 'clsx';
|
||||
import CopyCode from 'components/post/copy-code';
|
||||
import { createElement, Fragment, memo } from 'react';
|
||||
import rehypeHighlight from 'rehype-highlight';
|
||||
import rehypeReact from 'rehype-react';
|
||||
import remarkGfm from 'remark-gfm';
|
||||
import remarkParse from 'remark-parse';
|
||||
import remarkRehype from 'remark-rehype';
|
||||
import rehypeHighlight from 'rehype-highlight';
|
||||
import { GistsFile } from 'types';
|
||||
import { unified } from 'unified';
|
||||
import styles from './gists-code.module.css';
|
||||
import '@catppuccin/highlightjs/sass/catppuccin.variables.scss';
|
||||
|
||||
interface Props {
|
||||
file: GistsFile;
|
||||
@ -77,10 +78,16 @@ const GistsCode = ({ file, showFileName = false }: Props) => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>{code}</div>
|
||||
<div className={'relative group'}>
|
||||
{code}
|
||||
<CopyCode />
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div>{code}</div>
|
||||
<div className={'relative group'}>
|
||||
{code}
|
||||
<CopyCode />
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
Reference in New Issue
Block a user