Skip to content

Commit

Permalink
Fix syntax highlighting issues
Browse files Browse the repository at this point in the history
Please refer to transitive-bullshit/nextjs-notion-starter-kit#309
and #220 for more
context.
  • Loading branch information
powersagitar committed Mar 19, 2024
1 parent e1f03de commit ff35995
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions packages/react-notion-x/src/third-party/code.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,20 @@ export const Code: React.FC<{
const copyTimeout = React.useRef<number>()
const { recordMap } = useNotionContext()
const content = getBlockTitle(block, recordMap)
const language = (
block.properties?.language?.[0]?.[0] || defaultLanguage
).toLowerCase()
const language = (() => {
const languageNotion = (
block.properties?.language?.[0]?.[0] || defaultLanguage
).toLowerCase()

switch (languageNotion) {
case 'c++':
return 'cpp'
case 'f#':
return 'fsharp'
default:
return languageNotion
}
})()
const caption = block.properties.caption

const codeRef = React.useRef()
Expand Down

0 comments on commit ff35995

Please sign in to comment.