We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2b63fb1 + ff35995 commit 4c98c80Copy full SHA for 4c98c80
packages/react-notion-x/src/third-party/code.tsx
@@ -28,9 +28,20 @@ export const Code: React.FC<{
28
const copyTimeout = React.useRef<number>()
29
const { recordMap } = useNotionContext()
30
const content = getBlockTitle(block, recordMap)
31
- const language = (
32
- block.properties?.language?.[0]?.[0] || defaultLanguage
33
- ).toLowerCase()
+ const language = (() => {
+ const languageNotion = (
+ block.properties?.language?.[0]?.[0] || defaultLanguage
34
+ ).toLowerCase()
35
+
36
+ switch (languageNotion) {
37
+ case 'c++':
38
+ return 'cpp'
39
+ case 'f#':
40
+ return 'fsharp'
41
+ default:
42
+ return languageNotion
43
+ }
44
+ })()
45
const caption = block.properties.caption
46
47
const codeRef = React.useRef()
0 commit comments