mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-15 16:51:37 +00:00
add single gist slice with 20 lines
This commit is contained in:
@ -15,6 +15,9 @@ interface Props {
|
||||
}
|
||||
|
||||
const GistsCode = ({ file, showFileName = false }: Props) => {
|
||||
const fileContent = showFileName
|
||||
? file.content
|
||||
: file.content?.split('\n').slice(0, 20).join('\n');
|
||||
const code = unified()
|
||||
.use(remarkParse)
|
||||
.use(remarkRehype)
|
||||
@ -24,7 +27,7 @@ const GistsCode = ({ file, showFileName = false }: Props) => {
|
||||
createElement,
|
||||
Fragment,
|
||||
})
|
||||
.processSync(`\`\`\`${file.language ?? ''}\n${file.content}`).result;
|
||||
.processSync(`\`\`\`${file.language ?? ''}\n${fileContent}`).result;
|
||||
|
||||
return (
|
||||
<>
|
||||
|
Reference in New Issue
Block a user