File tree Expand file tree Collapse file tree 3 files changed +88
-0
lines changed Expand file tree Collapse file tree 3 files changed +88
-0
lines changed Original file line number Diff line number Diff line change 1
1
export * as Blocks from './builders' ;
2
2
export * as Types from './types' ;
3
+ export * as Utils from './utils' ;
Original file line number Diff line number Diff line change
1
+ import { Code } from 'notion-api-types/responses/blocks' ;
2
+
1
3
export * from 'notion-api-types' ;
4
+ export type CodeLang = Code [ 'code' ] [ 'language' ] ;
Original file line number Diff line number Diff line change
1
+ import { CodeLang } from './types' ;
2
+
3
+ /** This is just to keep a value with all languages, so that is can be used at runtime */
4
+ const codeLangs : Record < CodeLang , null > = {
5
+ abap : null ,
6
+ arduino : null ,
7
+ bash : null ,
8
+ basic : null ,
9
+ c : null ,
10
+ clojure : null ,
11
+ coffeescript : null ,
12
+ 'c++' : null ,
13
+ 'c#' : null ,
14
+ css : null ,
15
+ dart : null ,
16
+ diff : null ,
17
+ docker : null ,
18
+ elixir : null ,
19
+ elm : null ,
20
+ erlang : null ,
21
+ flow : null ,
22
+ fortran : null ,
23
+ 'f#' : null ,
24
+ gherkin : null ,
25
+ glsl : null ,
26
+ go : null ,
27
+ graphql : null ,
28
+ groovy : null ,
29
+ haskell : null ,
30
+ html : null ,
31
+ java : null ,
32
+ javascript : null ,
33
+ json : null ,
34
+ julia : null ,
35
+ kotlin : null ,
36
+ latex : null ,
37
+ less : null ,
38
+ lisp : null ,
39
+ livescript : null ,
40
+ lua : null ,
41
+ makefile : null ,
42
+ markdown : null ,
43
+ markup : null ,
44
+ matlab : null ,
45
+ mermaid : null ,
46
+ nix : null ,
47
+ 'objective-c' : null ,
48
+ ocaml : null ,
49
+ pascal : null ,
50
+ perl : null ,
51
+ php : null ,
52
+ 'plain text' : null ,
53
+ powershell : null ,
54
+ prolog : null ,
55
+ protobuf : null ,
56
+ python : null ,
57
+ r : null ,
58
+ reason : null ,
59
+ ruby : null ,
60
+ rust : null ,
61
+ sass : null ,
62
+ scala : null ,
63
+ scheme : null ,
64
+ scss : null ,
65
+ shell : null ,
66
+ sql : null ,
67
+ swift : null ,
68
+ typescript : null ,
69
+ 'vb.net' : null ,
70
+ verilog : null ,
71
+ vhdl : null ,
72
+ 'visual basic' : null ,
73
+ webassembly : null ,
74
+ xml : null ,
75
+ yaml : null ,
76
+ 'java/c/c++/c#' : null ,
77
+ } ;
78
+
79
+ /**
80
+ * Returns whether a string is a supported language for `code` blocks
81
+ */
82
+ export function isCodeLang ( str : string ) : str is CodeLang {
83
+ return Object . keys ( codeLangs ) . includes ( str ) ;
84
+ }
You can’t perform that action at this time.
0 commit comments