Skip to content

Commit

Permalink
fix: 修复代码块样式错误
Browse files Browse the repository at this point in the history
  • Loading branch information
huayemao committed Jun 21, 2024
1 parent bf91648 commit 822e743
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 36 deletions.
2 changes: 1 addition & 1 deletion components/Post/ContentModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function ContentModal() {
>
<div
contentEditable
className="prose lg:prose-xl prose-code:bg-primary-100 prose-code:text-primary-500 prose-code:font-medium w-full h-full max-w-full"
className="prose lg:prose-xl w-full h-full max-w-full"
style={{
columns: "2 auto",
columnRule: "1px solid #e5e7eb",
Expand Down
2 changes: 1 addition & 1 deletion components/Post/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default async function Post({ data: post, recentPosts: posts }: Props) {
className={
c.content +
" " +
"dark:prose-invert prose lg:prose-xl py-6 prose-code:bg-primary-100 prose-code:text-primary-500 prose-code:font-medium overflow-hidden"
"dark:prose-invert prose lg:prose-xl py-6 overflow-hidden"
}
>
{content}
Expand Down
74 changes: 40 additions & 34 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,44 +16,50 @@ module.exports = withShurikenUI({
nui: {},
typography: {
DEFAULT: {
css: [{
ul: {
breakInside: 'avoid',
},
ol: {
breakInside: 'avoid',
},
blockquote: {
breakInside: 'avoid',
},
table: {
'@media (max-width: 576px)': {
// 如果 table 设置成 display:block 来产生滚动条会导致内容无法自动扩展到全宽
td: {
wordBreak: 'break-all'
}
css: [
{
code: {
fontWeight: 500,
color: 'rgb(99,102,241)',
backgroundColor: 'rgb(224,231,255)'
},
ul: {
breakInside: 'avoid',
},
ol: {
breakInside: 'avoid',
},
blockquote: {
breakInside: 'avoid',
},
},
figure: {
marginBottom: '2em',
figcaption: { textAlign: 'center' },
img: {
marginBottom: 0,
}
},
tr: {
th: {
'&:first-child': {
whiteSpace: 'nowrap'
table: {
'@media (max-width: 576px)': {
// 如果 table 设置成 display:block 来产生滚动条会导致内容无法自动扩展到全宽
td: {
wordBreak: 'break-all'
}
},
},
figure: {
marginBottom: '2em',
figcaption: { textAlign: 'center' },
img: {
marginBottom: 0,
}
},
td: {
'&:first-child': {
whiteSpace: 'nowrap'
tr: {
th: {
'&:first-child': {
whiteSpace: 'nowrap'
}
},
}
},
}]
td: {
'&:first-child': {
whiteSpace: 'nowrap'
},
}
},
}]
}
},
fontFamily: {
Expand Down

0 comments on commit 822e743

Please sign in to comment.