Skip to content

Commit

Permalink
feat: Add inline code styling to prose
Browse files Browse the repository at this point in the history
  • Loading branch information
pheralb committed Jun 4, 2024
1 parent 5ca2ca9 commit 72125e0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
1 change: 1 addition & 0 deletions website/app/ui/prose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ export const proseClasses = cn(
'prose-a:underline-offset-[4px] prose-a:decoration-solid dark:prose-a:decoration-neutral-500 prose-a:decoration-neutral-400',
'prose-figure:my-0 prose-p:mb-1 prose-p:text-pretty',
'prose-ol:mb-0',
'prose-inline-code:rounded prose-inline-code:font-mono prose-inline-code:p-[2px] prose-inline-code:border prose-inline-code:border-neutral-300 prose-inline-code:bg-neutral-200/50 prose-inline-code:dark:border-neutral-800 prose-inline-code:dark:bg-neutral-800/50',
);
31 changes: 27 additions & 4 deletions website/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import type { Config } from 'tailwindcss';

// Plugins:
import plugin from 'tailwindcss/plugin';
import twAnimate from 'tailwindcss-animate';
import typography from '@tailwindcss/typography';
import { fontFamily } from 'tailwindcss/defaultTheme';
import defaultTheme from 'tailwindcss/defaultTheme';

const config = {
darkMode: ['class'],
Expand All @@ -23,8 +25,20 @@ const config = {
},
extend: {
fontFamily: {
sans: ['Geist', ...fontFamily.sans],
mono: ['GeistMono', ...fontFamily.mono],
sans: ['Geist', ...defaultTheme.fontFamily.sans],
mono: ['GeistMono', ...defaultTheme.fontFamily.mono],
},
typography: {
DEFAULT: {
css: {
'code::before': {
content: '""',
},
'code::after': {
content: '""',
},
},
},
},
keyframes: {
'accordion-down': {
Expand Down Expand Up @@ -54,7 +68,16 @@ const config = {
},
},
},
plugins: [twAnimate, typography],
plugins: [
twAnimate,
typography,
plugin(function ({ addVariant }) {
addVariant(
'prose-inline-code',
'&.prose :where(:not(pre)>code):not(:where([class~="not-prose"] *))',
);
}),
],
} satisfies Config;

export default config;

0 comments on commit 72125e0

Please sign in to comment.