Skip to content

Commit 1a0ec51

Browse files
committed
fix: codeblock indent
1 parent a85f042 commit 1a0ec51

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

src/pages/BlogPostPage.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ const CodeBlock = ({
104104
<SyntaxHighlighter
105105
style={customTheme}
106106
language={match[1]}
107-
PreTag="div"
107+
PreTag="pre"
108+
CodeTag="code"
109+
// className="not-prose"
108110
{...props}
109111
codeTagProps={{ style: { fontFamily: "'JetBrains Mono', monospace" } }}
110112
>

tailwind.config.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@ const colors = require('./src/config/colors');
33
const fonts = require('./src/config/fonts'); // New import
44

55
/** @type {import('tailwindcss').Config} */
6+
/**
7+
* fezcode: important
8+
* tailwind.config.js affects colors through the @tailwindcss/typography plugin, which styles markdown-generated HTML. Specifically, the typography
9+
* extension in tailwind.config.js allows customizing these styles. Our recent change modified the code element's color within the dark typography variant
10+
* to primary.400 (red).
11+
*
12+
* This change resolved a conflict where tailwind.config.js's prose-dark styles were overriding react-syntax-highlighter's customTheme.js base color for
13+
* the <code> element due to CSS specificity. By setting the code color directly in tailwind.config.js to red, we ensured the dominant styling rule for
14+
* the code block's base text color was the desired red, while customTheme.js still colors individual <span> tokens (comments, keywords) with more
15+
* specific rules.
16+
*/
617
module.exports = {
718
darkMode: 'class',
819
content: [
@@ -57,7 +68,7 @@ module.exports = {
5768
},
5869

5970
code: {
60-
color: theme('colors.gray.100'),
71+
color: theme('colors.primary.400'), // fezcode: important default text color for codeblocks
6172
fontFamily: theme('fontFamily.mono'),
6273
},
6374

@@ -83,4 +94,4 @@ module.exports = {
8394
plugins: [
8495
require('@tailwindcss/typography'),
8596
],
86-
}
97+
}

0 commit comments

Comments
 (0)