Skip to content

Commit

Permalink
Merge pull request #546 from powerium/patch/syntax-highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
transitive-bullshit authored Oct 31, 2024
2 parents 2b63fb1 + ff35995 commit 4c98c80
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 4c98c80

Please sign in to comment.