Skip to content

Commit

Permalink
fix(ui): show background when code-block missing languages
Browse files Browse the repository at this point in the history
  • Loading branch information
ddiu8081 committed May 24, 2023
1 parent 16a056c commit 3a47e9f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/assets/prism.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ html:not(.dark) {
--prism-json-property: var(--prism-literal);
--prism-line-number: #aaaaaa;
--prism-line-highlight-background: #f2f2f2;
--prism-block-padding-x: 20px;
--prism-block-padding-y: 14px;
--prism-block-padding-x: 1.25rem;
--prism-block-padding-y: 1.5rem;
--prism-block-radius: .375rem;
}

html.dark {
Expand Down Expand Up @@ -55,6 +56,7 @@ html.dark {
--prism-line-number-gutter: #eeeeee;
--prism-line-highlight-background: #333333;
--prism-selection-background: #444444;
--prism-block-padding-x: 20px;
--prism-block-padding-y: 14px;
--prism-block-padding-x: 1.25rem;
--prism-block-padding-y: 1.5rem;
--prism-block-radius: .375rem;
}
4 changes: 3 additions & 1 deletion src/components/Markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ const parseMarkdown = (raw: string) => {
.use(remarkGfm)
.use(remarkMath)
.use(remarkRehype)
.use(rehypePrism)
.use(rehypePrism, {
ignoreMissing: true,
})
.use(rehypeKatex)
.use(rehypeStringify)
.processSync(raw)
Expand Down
3 changes: 3 additions & 0 deletions unocss.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ export default defineConfig({
'padding': '0 0.2em',
'color': 'var(--prism-keyword)',
},
'pre': {
'background-color': 'var(--prism-background) !important',
},
},
}),
],
Expand Down

0 comments on commit 3a47e9f

Please sign in to comment.