Skip to content

Commit

Permalink
Rollback.
Browse files Browse the repository at this point in the history
  • Loading branch information
RavelloH committed Oct 28, 2024
1 parent e54a242 commit 194733b
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/app/manage/posts/draft/[slug]/page.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import prisma from '@/app/api/_utils/prisma';
import config from '@/../config';
import { MDXRemote } from 'next-mdx-remote/rsc';
import { getHighlighter } from 'shiki';
import remarkShikiTwoslash from 'remark-shiki-twoslash';
import Comment from '@/components/Comment';
import PostSuggestion from '@/components/PostSuggeston';
import Link from 'next/link';
import formatDateWithTimeZone from '@/utils/time';
import { cookies } from 'next/headers';
import NotFound from '@/app/not-found';
import tokenServer from '@/app/api/_utils/token';

let title;

function createCategory(arr) {
Expand All @@ -21,7 +18,7 @@ function createCategory(arr) {
}
return element;
});
return <span className='class'>{joinedElements}</span>;
return <sapn className='class'>{joinedElements}</sapn>;
}

function createTag(arr) {
Expand Down Expand Up @@ -83,10 +80,6 @@ export default async function DraftContent(params) {

title = post.title;

// 使用 Shiki 高亮代码
const highlighter = await getHighlighter({ theme: 'nord' });
const highlightedContent = await highlighter.codeToHtml(post.content, { lang: 'markdown' });

return (
<article>
<div id='articles-header'>
Expand All @@ -101,13 +94,14 @@ export default async function DraftContent(params) {
{createCategory(post.category)} {' • '}
<span className='ri-t-box-line'></span>{' '}
<span id='textLength'>{post.content.length}</span>
{/* {' • '}<span className='ri-search-eye-line'></span> <span id='pageVisitors'>---</span> */}
</p>
{createTag(post.tag)}
<hr />
</div>

<div id='articles-body'>
<MDXRemote source={highlightedContent} components={{ a: Link }} />
<MDXRemote source={post.content.replaceAll('{', '\\{')} components={{ a: Link }} />
</div>
<div id='articles-footer'>
<hr />
Expand Down Expand Up @@ -167,4 +161,4 @@ export async function generateMetadata({ params }) {
return {
title: post.title,
};
}
}

0 comments on commit 194733b

Please sign in to comment.