@atlaskit/editor-plugin-code-block-advanced 12.0.31 → 12.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @atlaskit/editor-plugin-code-block-advanced
2
2
 
3
+ ## 12.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`6891ca32d94cc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6891ca32d94cc) -
8
+ Add `Mermaid` as a selectable language in the code block language picker, behind the
9
+ `platform_editor_code_block_mermaid_language` feature gate. When the gate is enabled, Mermaid
10
+ appears in the picker and the advanced (CodeMirror) code block provides Mermaid syntax
11
+ highlighting via `codemirror-lang-mermaid`. The language is intentionally kept out of the shared
12
+ `@atlaskit/code` supported-languages list so it is fully gated and does not leak into other
13
+ consumers.
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies
18
+
19
+ ## 12.0.32
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies
24
+
3
25
  ## 12.0.31
4
26
 
5
27
  ### Patch Changes
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.default = exports.DEFAULT_LANGUAGES = void 0;
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
9
  var _constants = require("@atlaskit/code/constants");
10
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
11
  // We expect alias[0] to be used for the ADF attribute, see ED-2813
11
12
  var DEFAULT_LANGUAGES = exports.DEFAULT_LANGUAGES = [{
12
13
  name: '(None)',
@@ -17,6 +18,11 @@ var getLanguageName = function getLanguageName(languageValue) {
17
18
  if (!languageValue) {
18
19
  return undefined;
19
20
  }
21
+
22
+ // mermaid is gated out of the shared SUPPORTED_LANGUAGES list, so resolve it here
23
+ if (languageValue === 'mermaid' && (0, _platformFeatureFlags.fg)('platform_editor_code_block_mermaid_language')) {
24
+ return 'Mermaid';
25
+ }
20
26
  var language = _constants.SUPPORTED_LANGUAGES.find(function (l) {
21
27
  return l.value === languageValue || l.alias && l.alias.includes(languageValue);
22
28
  });
@@ -8,12 +8,35 @@ exports.mapLanguageToCodeMirror = void 0;
8
8
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
9
9
  var _language = require("@codemirror/language");
10
10
  var _languageData = require("@codemirror/language-data");
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
12
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != (0, _typeof2.default)(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
12
13
  // getLanguageIdentifier defines `language.alias[0]`
13
14
  var mapLanguageToCodeMirror = exports.mapLanguageToCodeMirror = function mapLanguageToCodeMirror(language) {
14
15
  if (!language || language === 'none') {
15
16
  return undefined;
16
17
  }
18
+ // mermaid is gated out of the shared SUPPORTED_LANGUAGES list; load its grammar only when the gate is on
19
+ if (language === 'mermaid') {
20
+ if (!(0, _platformFeatureFlags.fg)('platform_editor_code_block_mermaid_language')) {
21
+ return undefined;
22
+ }
23
+ return _language.LanguageDescription.of({
24
+ name: 'Mermaid',
25
+ load: function load() {
26
+ return Promise.resolve().then(function () {
27
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlaskit/editor-plugin-code-block-advanced-lang-mermaid" */
28
+ 'codemirror-lang-mermaid'));
29
+ }).then(function (m) {
30
+ return (
31
+ // Construct locally (like the Handlebars case) to avoid a type clash between
32
+ // this package's `@codemirror/language` and the copy codemirror-lang-mermaid
33
+ // bundles; equivalent to the package's own `mermaid()`.
34
+ new _language.LanguageSupport(m.mermaidLanguage)
35
+ );
36
+ });
37
+ }
38
+ });
39
+ }
17
40
  switch (language) {
18
41
  case 'markdown':
19
42
  return _language.LanguageDescription.of({
@@ -1,4 +1,5 @@
1
1
  import { SUPPORTED_LANGUAGES } from '@atlaskit/code/constants';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
 
3
4
  // We expect alias[0] to be used for the ADF attribute, see ED-2813
4
5
  export const DEFAULT_LANGUAGES = [{
@@ -10,6 +11,11 @@ const getLanguageName = languageValue => {
10
11
  if (!languageValue) {
11
12
  return undefined;
12
13
  }
14
+
15
+ // mermaid is gated out of the shared SUPPORTED_LANGUAGES list, so resolve it here
16
+ if (languageValue === 'mermaid' && fg('platform_editor_code_block_mermaid_language')) {
17
+ return 'Mermaid';
18
+ }
13
19
  const language = SUPPORTED_LANGUAGES.find(l => {
14
20
  return l.value === languageValue || l.alias && l.alias.includes(languageValue);
15
21
  });
@@ -1,10 +1,28 @@
1
1
  import { LanguageDescription, LanguageSupport } from '@codemirror/language';
2
2
  import { languages } from '@codemirror/language-data';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
3
4
  // getLanguageIdentifier defines `language.alias[0]`
4
5
  export const mapLanguageToCodeMirror = language => {
5
6
  if (!language || language === 'none') {
6
7
  return undefined;
7
8
  }
9
+ // mermaid is gated out of the shared SUPPORTED_LANGUAGES list; load its grammar only when the gate is on
10
+ if (language === 'mermaid') {
11
+ if (!fg('platform_editor_code_block_mermaid_language')) {
12
+ return undefined;
13
+ }
14
+ return LanguageDescription.of({
15
+ name: 'Mermaid',
16
+ load() {
17
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlaskit/editor-plugin-code-block-advanced-lang-mermaid" */
18
+ 'codemirror-lang-mermaid').then(m =>
19
+ // Construct locally (like the Handlebars case) to avoid a type clash between
20
+ // this package's `@codemirror/language` and the copy codemirror-lang-mermaid
21
+ // bundles; equivalent to the package's own `mermaid()`.
22
+ new LanguageSupport(m.mermaidLanguage));
23
+ }
24
+ });
25
+ }
8
26
  switch (language) {
9
27
  case 'markdown':
10
28
  return LanguageDescription.of({
@@ -1,5 +1,6 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import { SUPPORTED_LANGUAGES } from '@atlaskit/code/constants';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
3
4
 
4
5
  // We expect alias[0] to be used for the ADF attribute, see ED-2813
5
6
  export var DEFAULT_LANGUAGES = [{
@@ -11,6 +12,11 @@ var getLanguageName = function getLanguageName(languageValue) {
11
12
  if (!languageValue) {
12
13
  return undefined;
13
14
  }
15
+
16
+ // mermaid is gated out of the shared SUPPORTED_LANGUAGES list, so resolve it here
17
+ if (languageValue === 'mermaid' && fg('platform_editor_code_block_mermaid_language')) {
18
+ return 'Mermaid';
19
+ }
14
20
  var language = SUPPORTED_LANGUAGES.find(function (l) {
15
21
  return l.value === languageValue || l.alias && l.alias.includes(languageValue);
16
22
  });
@@ -1,10 +1,31 @@
1
1
  import { LanguageDescription, LanguageSupport } from '@codemirror/language';
2
2
  import { languages } from '@codemirror/language-data';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
3
4
  // getLanguageIdentifier defines `language.alias[0]`
4
5
  export var mapLanguageToCodeMirror = function mapLanguageToCodeMirror(language) {
5
6
  if (!language || language === 'none') {
6
7
  return undefined;
7
8
  }
9
+ // mermaid is gated out of the shared SUPPORTED_LANGUAGES list; load its grammar only when the gate is on
10
+ if (language === 'mermaid') {
11
+ if (!fg('platform_editor_code_block_mermaid_language')) {
12
+ return undefined;
13
+ }
14
+ return LanguageDescription.of({
15
+ name: 'Mermaid',
16
+ load: function load() {
17
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlaskit/editor-plugin-code-block-advanced-lang-mermaid" */
18
+ 'codemirror-lang-mermaid').then(function (m) {
19
+ return (
20
+ // Construct locally (like the Handlebars case) to avoid a type clash between
21
+ // this package's `@codemirror/language` and the copy codemirror-lang-mermaid
22
+ // bundles; equivalent to the package's own `mermaid()`.
23
+ new LanguageSupport(m.mermaidLanguage)
24
+ );
25
+ });
26
+ }
27
+ });
28
+ }
8
29
  switch (language) {
9
30
  case 'markdown':
10
31
  return LanguageDescription.of({
@@ -1,93 +1,92 @@
1
1
  export declare const DEFAULT_LANGUAGES: ({
2
- readonly name: 'PHP';
3
2
  readonly alias: readonly ['php', 'php3', 'php4', 'php5'];
3
+ readonly name: 'PHP';
4
4
  readonly value: 'php';
5
5
  } | {
6
- readonly name: 'Java';
7
6
  readonly alias: readonly ['java'];
7
+ readonly name: 'Java';
8
8
  readonly value: 'java';
9
9
  } | {
10
- readonly name: 'CSharp';
11
10
  readonly alias: readonly ['csharp', 'c#'];
11
+ readonly name: 'CSharp';
12
12
  readonly value: 'cs';
13
13
  } | {
14
- readonly name: 'Python';
15
14
  readonly alias: readonly ['python', 'py'];
15
+ readonly name: 'Python';
16
16
  readonly value: 'python';
17
17
  } | {
18
- readonly name: 'JavaScript';
19
18
  readonly alias: readonly ['javascript', 'js'];
19
+ readonly name: 'JavaScript';
20
20
  readonly value: 'javascript';
21
21
  } | {
22
- readonly name: 'Html';
23
22
  readonly alias: readonly ['html'];
23
+ readonly name: 'Html';
24
24
  readonly value: 'xml';
25
25
  } | {
26
- readonly name: 'C++';
27
26
  readonly alias: readonly ['c++', 'cpp', 'clike'];
27
+ readonly name: 'C++';
28
28
  readonly value: 'cpp';
29
29
  } | {
30
- readonly name: 'Ruby';
31
30
  readonly alias: readonly ['ruby', 'rb', 'duby'];
31
+ readonly name: 'Ruby';
32
32
  readonly value: 'ruby';
33
33
  } | {
34
- readonly name: 'Objective-C';
35
34
  readonly alias: readonly ['objective-c', 'objectivec', 'obj-c', 'objc'];
35
+ readonly name: 'Objective-C';
36
36
  readonly value: 'objectivec';
37
37
  } | {
38
- readonly name: 'C';
39
38
  readonly alias: readonly ['c'];
39
+ readonly name: 'C';
40
40
  readonly value: 'cpp';
41
41
  } | {
42
- readonly name: 'Swift';
43
42
  readonly alias: readonly ['swift'];
43
+ readonly name: 'Swift';
44
44
  readonly value: 'swift';
45
45
  } | {
46
- readonly name: 'TeX';
47
46
  readonly alias: readonly ['tex', 'latex'];
47
+ readonly name: 'TeX';
48
48
  readonly value: 'tex';
49
49
  } | {
50
- readonly name: 'Shell';
51
50
  readonly alias: readonly ['shell', 'bash', 'sh', 'ksh', 'zsh'];
51
+ readonly name: 'Shell';
52
52
  readonly value: 'shell';
53
53
  } | {
54
- readonly name: 'Scala';
55
54
  readonly alias: readonly ['scala'];
55
+ readonly name: 'Scala';
56
56
  readonly value: 'scala';
57
57
  } | {
58
- readonly name: 'Go';
59
58
  readonly alias: readonly ['go'];
59
+ readonly name: 'Go';
60
60
  readonly value: 'go';
61
61
  } | {
62
- readonly name: 'ActionScript';
63
62
  readonly alias: readonly ['actionscript', 'actionscript3', 'as'];
63
+ readonly name: 'ActionScript';
64
64
  readonly value: 'actionscript';
65
65
  } | {
66
- readonly name: 'ColdFusion';
67
66
  readonly alias: readonly ['coldfusion'];
67
+ readonly name: 'ColdFusion';
68
68
  readonly value: 'xml';
69
69
  } | {
70
- readonly name: 'JavaFX';
71
70
  readonly alias: readonly ['javafx', 'jfx'];
71
+ readonly name: 'JavaFX';
72
72
  readonly value: 'java';
73
73
  } | {
74
- readonly name: 'VbNet';
75
74
  readonly alias: readonly ['vbnet', 'vb.net', 'vfp', 'clipper', 'xbase'];
75
+ readonly name: 'VbNet';
76
76
  readonly value: 'vbnet';
77
77
  } | {
78
- readonly name: 'JSON';
79
78
  readonly alias: readonly ['json'];
79
+ readonly name: 'JSON';
80
80
  readonly value: 'json';
81
81
  } | {
82
- readonly name: 'MATLAB';
83
82
  readonly alias: readonly ['matlab'];
83
+ readonly name: 'MATLAB';
84
84
  readonly value: 'matlab';
85
85
  } | {
86
- readonly name: 'Groovy';
87
86
  readonly alias: readonly ['groovy'];
87
+ readonly name: 'Groovy';
88
88
  readonly value: 'groovy';
89
89
  } | {
90
- readonly name: 'SQL';
91
90
  readonly alias: readonly [
92
91
  'sql',
93
92
  'postgresql',
@@ -101,258 +100,259 @@ export declare const DEFAULT_LANGUAGES: ({
101
100
  'mysql',
102
101
  'sqlite'
103
102
  ];
103
+ readonly name: 'SQL';
104
104
  readonly value: 'sql';
105
105
  } | {
106
- readonly name: 'R';
107
106
  readonly alias: readonly ['r'];
107
+ readonly name: 'R';
108
108
  readonly value: 'r';
109
109
  } | {
110
- readonly name: 'Perl';
111
110
  readonly alias: readonly ['perl', 'pl'];
111
+ readonly name: 'Perl';
112
112
  readonly value: 'perl';
113
113
  } | {
114
- readonly name: 'Lua';
115
114
  readonly alias: readonly ['lua'];
115
+ readonly name: 'Lua';
116
116
  readonly value: 'lua';
117
117
  } | {
118
- readonly name: 'Pascal';
119
118
  readonly alias: readonly ['pas', 'pascal', 'objectpascal', 'delphi'];
119
+ readonly name: 'Pascal';
120
120
  readonly value: 'pascal';
121
121
  } | {
122
- readonly name: 'XML';
123
122
  readonly alias: readonly ['xml'];
123
+ readonly name: 'XML';
124
124
  readonly value: 'xml';
125
125
  } | {
126
- readonly name: 'TypeScript';
127
126
  readonly alias: readonly ['typescript', 'ts'];
127
+ readonly name: 'TypeScript';
128
128
  readonly value: 'typescript';
129
129
  } | {
130
- readonly name: 'CoffeeScript';
131
130
  readonly alias: readonly ['coffeescript', 'coffee-script', 'coffee'];
131
+ readonly name: 'CoffeeScript';
132
132
  readonly value: 'coffeescript';
133
133
  } | {
134
- readonly name: 'Haskell';
135
134
  readonly alias: readonly ['haskell', 'hs'];
135
+ readonly name: 'Haskell';
136
136
  readonly value: 'haskell';
137
137
  } | {
138
- readonly name: 'Puppet';
139
138
  readonly alias: readonly ['puppet'];
139
+ readonly name: 'Puppet';
140
140
  readonly value: 'puppet';
141
141
  } | {
142
- readonly name: 'Arduino';
143
142
  readonly alias: readonly ['arduino'];
143
+ readonly name: 'Arduino';
144
144
  readonly value: 'arduino';
145
145
  } | {
146
- readonly name: 'Fortran';
147
146
  readonly alias: readonly ['fortran'];
147
+ readonly name: 'Fortran';
148
148
  readonly value: 'fortran';
149
149
  } | {
150
- readonly name: 'Erlang';
151
150
  readonly alias: readonly ['erlang', 'erl'];
151
+ readonly name: 'Erlang';
152
152
  readonly value: 'erlang';
153
153
  } | {
154
- readonly name: 'PowerShell';
155
154
  readonly alias: readonly ['powershell', 'posh', 'ps1', 'psm1'];
155
+ readonly name: 'PowerShell';
156
156
  readonly value: 'powershell';
157
157
  } | {
158
- readonly name: 'Haxe';
159
158
  readonly alias: readonly ['haxe', 'hx', 'hxsl'];
159
+ readonly name: 'Haxe';
160
160
  readonly value: 'haxe';
161
161
  } | {
162
- readonly name: 'Elixir';
163
162
  readonly alias: readonly ['elixir', 'ex', 'exs'];
163
+ readonly name: 'Elixir';
164
164
  readonly value: 'elixir';
165
165
  } | {
166
- readonly name: 'Verilog';
167
166
  readonly alias: readonly ['verilog', 'v'];
167
+ readonly name: 'Verilog';
168
168
  readonly value: 'verilog';
169
169
  } | {
170
- readonly name: 'Rust';
171
170
  readonly alias: readonly ['rust'];
171
+ readonly name: 'Rust';
172
172
  readonly value: 'rust';
173
173
  } | {
174
- readonly name: 'VHDL';
175
174
  readonly alias: readonly ['vhdl'];
175
+ readonly name: 'VHDL';
176
176
  readonly value: 'vhdl';
177
177
  } | {
178
- readonly name: 'Sass';
179
178
  readonly alias: readonly ['sass'];
179
+ readonly name: 'Sass';
180
180
  readonly value: 'less';
181
181
  } | {
182
- readonly name: 'OCaml';
183
182
  readonly alias: readonly ['ocaml'];
183
+ readonly name: 'OCaml';
184
184
  readonly value: 'ocaml';
185
185
  } | {
186
- readonly name: 'Dart';
187
186
  readonly alias: readonly ['dart'];
187
+ readonly name: 'Dart';
188
188
  readonly value: 'dart';
189
189
  } | {
190
- readonly name: 'CSS';
191
190
  readonly alias: readonly ['css'];
191
+ readonly name: 'CSS';
192
192
  readonly value: 'css';
193
193
  } | {
194
- readonly name: 'reStructuredText';
195
194
  readonly alias: readonly ['restructuredtext', 'rst', 'rest'];
195
+ readonly name: 'reStructuredText';
196
196
  readonly value: 'rest';
197
197
  } | {
198
- readonly name: 'Kotlin';
199
198
  readonly alias: readonly ['kotlin'];
199
+ readonly name: 'Kotlin';
200
200
  readonly value: 'kotlin';
201
201
  } | {
202
- readonly name: 'D';
203
202
  readonly alias: readonly ['d'];
203
+ readonly name: 'D';
204
204
  readonly value: 'd';
205
205
  } | {
206
- readonly name: 'Octave';
207
206
  readonly alias: readonly ['octave'];
207
+ readonly name: 'Octave';
208
208
  readonly value: 'matlab';
209
209
  } | {
210
- readonly name: 'QML';
211
210
  readonly alias: readonly ['qbs', 'qml'];
211
+ readonly name: 'QML';
212
212
  readonly value: 'qml';
213
213
  } | {
214
- readonly name: 'Prolog';
215
214
  readonly alias: readonly ['prolog'];
215
+ readonly name: 'Prolog';
216
216
  readonly value: 'prolog';
217
217
  } | {
218
- readonly name: 'FoxPro';
219
218
  readonly alias: readonly ['foxpro', 'purebasic'];
219
+ readonly name: 'FoxPro';
220
220
  readonly value: 'purebasic';
221
221
  } | {
222
- readonly name: 'Scheme';
223
222
  readonly alias: readonly ['scheme', 'scm'];
223
+ readonly name: 'Scheme';
224
224
  readonly value: 'scheme';
225
225
  } | {
226
- readonly name: 'CUDA';
227
226
  readonly alias: readonly ['cuda', 'cu'];
227
+ readonly name: 'CUDA';
228
228
  readonly value: 'cpp';
229
229
  } | {
230
- readonly name: 'Julia';
231
230
  readonly alias: readonly ['julia', 'jl'];
231
+ readonly name: 'Julia';
232
232
  readonly value: 'julia';
233
233
  } | {
234
- readonly name: 'Racket';
235
234
  readonly alias: readonly ['racket', 'rkt'];
235
+ readonly name: 'Racket';
236
236
  readonly value: 'lisp';
237
237
  } | {
238
- readonly name: 'Ada';
239
238
  readonly alias: readonly ['ada', 'ada95', 'ada2005'];
239
+ readonly name: 'Ada';
240
240
  readonly value: 'ada';
241
241
  } | {
242
- readonly name: 'Tcl';
243
242
  readonly alias: readonly ['tcl'];
243
+ readonly name: 'Tcl';
244
244
  readonly value: 'tcl';
245
245
  } | {
246
- readonly name: 'Mathematica';
247
246
  readonly alias: readonly ['mathematica', 'mma', 'nb'];
247
+ readonly name: 'Mathematica';
248
248
  readonly value: 'mathematica';
249
249
  } | {
250
- readonly name: 'Autoit';
251
250
  readonly alias: readonly ['autoit'];
251
+ readonly name: 'Autoit';
252
252
  readonly value: 'autoit';
253
253
  } | {
254
- readonly name: 'StandardML';
255
254
  readonly alias: readonly ['standardmL', 'sml', 'standardml'];
255
+ readonly name: 'StandardML';
256
256
  readonly value: 'sml';
257
257
  } | {
258
- readonly name: 'Objective-J';
259
258
  readonly alias: readonly ['objective-j', 'objectivej', 'obj-j', 'objj'];
259
+ readonly name: 'Objective-J';
260
260
  readonly value: 'objectivec';
261
261
  } | {
262
- readonly name: 'Smalltalk';
263
262
  readonly alias: readonly ['smalltalk', 'squeak', 'st'];
263
+ readonly name: 'Smalltalk';
264
264
  readonly value: 'smalltalk';
265
265
  } | {
266
- readonly name: 'Vala';
267
266
  readonly alias: readonly ['vala', 'vapi'];
267
+ readonly name: 'Vala';
268
268
  readonly value: 'vala';
269
269
  } | {
270
- readonly name: 'LiveScript';
271
270
  readonly alias: readonly ['livescript', 'live-script'];
271
+ readonly name: 'LiveScript';
272
272
  readonly value: 'livescript';
273
273
  } | {
274
- readonly name: 'XQuery';
275
274
  readonly alias: readonly ['xquery', 'xqy', 'xq', 'xql', 'xqm'];
275
+ readonly name: 'XQuery';
276
276
  readonly value: 'xquery';
277
277
  } | {
278
- readonly name: 'PlainText';
279
278
  readonly alias: readonly ['text', 'plaintext'];
279
+ readonly name: 'PlainText';
280
280
  readonly value: 'text';
281
281
  } | {
282
- readonly name: 'Yaml';
283
282
  readonly alias: readonly ['yaml', 'yml'];
283
+ readonly name: 'Yaml';
284
284
  readonly value: 'yaml';
285
285
  } | {
286
- readonly name: 'GraphQL';
287
286
  readonly alias: readonly ['graphql'];
287
+ readonly name: 'GraphQL';
288
288
  readonly value: 'graphql';
289
289
  } | {
290
- readonly name: 'AppleScript';
291
290
  readonly alias: readonly ['applescript'];
291
+ readonly name: 'AppleScript';
292
292
  readonly value: 'applescript';
293
293
  } | {
294
- readonly name: 'Clojure';
295
294
  readonly alias: readonly ['clojure'];
295
+ readonly name: 'Clojure';
296
296
  readonly value: 'clojure';
297
297
  } | {
298
- readonly name: 'Diff';
299
298
  readonly alias: readonly ['diff'];
299
+ readonly name: 'Diff';
300
300
  readonly value: 'diff';
301
301
  } | {
302
- readonly name: 'VisualBasic';
303
302
  readonly alias: readonly ['visualbasic'];
303
+ readonly name: 'VisualBasic';
304
304
  readonly value: 'visual-basic';
305
305
  } | {
306
- readonly name: 'JSX';
307
306
  readonly alias: readonly ['jsx'];
307
+ readonly name: 'JSX';
308
308
  readonly value: 'jsx';
309
309
  } | {
310
- readonly name: 'TSX';
311
310
  readonly alias: readonly ['tsx'];
311
+ readonly name: 'TSX';
312
312
  readonly value: 'tsx';
313
313
  } | {
314
- readonly name: 'SplunkSPL';
315
314
  readonly alias: readonly ['splunk-spl'];
315
+ readonly name: 'SplunkSPL';
316
316
  readonly value: 'splunk-spl';
317
317
  } | {
318
- readonly name: 'Dockerfile';
319
318
  readonly alias: readonly ['docker', 'dockerfile'];
319
+ readonly name: 'Dockerfile';
320
320
  readonly value: 'dockerfile';
321
321
  } | {
322
- readonly name: 'HCL';
323
322
  readonly alias: readonly ['hcl', 'terraform'];
323
+ readonly name: 'HCL';
324
324
  readonly value: 'hcl';
325
325
  } | {
326
- readonly name: 'NGINX';
327
326
  readonly alias: readonly ['nginx'];
327
+ readonly name: 'NGINX';
328
328
  readonly value: 'nginx';
329
329
  } | {
330
- readonly name: 'Protocol Buffers';
331
330
  readonly alias: readonly ['protobuf', 'proto'];
331
+ readonly name: 'Protocol Buffers';
332
332
  readonly value: 'protobuf';
333
333
  } | {
334
- readonly name: 'TOML';
335
334
  readonly alias: readonly ['toml'];
335
+ readonly name: 'TOML';
336
336
  readonly value: 'toml';
337
337
  } | {
338
- readonly name: 'Handlebars';
339
338
  readonly alias: readonly ['handlebars', 'mustache'];
339
+ readonly name: 'Handlebars';
340
340
  readonly value: 'handlebars';
341
341
  } | {
342
- readonly name: 'Gherkin';
343
342
  readonly alias: readonly ['gherkin', 'cucumber'];
343
+ readonly name: 'Gherkin';
344
344
  readonly value: 'gherkin';
345
345
  } | {
346
- readonly name: 'ABAP';
347
346
  readonly alias: readonly ['abap'];
347
+ readonly name: 'ABAP';
348
348
  readonly value: 'abap';
349
349
  } | {
350
- readonly name: 'Markdown';
351
350
  readonly alias: readonly ['markdown'];
351
+ readonly name: 'Markdown';
352
352
  readonly value: 'markdown';
353
353
  } | {
354
- name: string;
355
354
  alias: string[];
355
+ name: string;
356
356
  value: string;
357
357
  })[];
358
358
  export type Language = (typeof DEFAULT_LANGUAGES)[number];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-code-block-advanced",
3
- "version": "12.0.31",
3
+ "version": "12.1.0",
4
4
  "description": "CodeBlockAdvanced plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -23,7 +23,7 @@
23
23
  "@atlaskit/adf-schema": "^56.1.0",
24
24
  "@atlaskit/code": "^18.2.0",
25
25
  "@atlaskit/editor-plugin-analytics": "^12.0.0",
26
- "@atlaskit/editor-plugin-code-block": "^14.1.0",
26
+ "@atlaskit/editor-plugin-code-block": "^14.2.0",
27
27
  "@atlaskit/editor-plugin-editor-disabled": "^12.0.0",
28
28
  "@atlaskit/editor-plugin-find-replace": "^12.0.0",
29
29
  "@atlaskit/editor-plugin-selection": "^12.0.0",
@@ -31,7 +31,7 @@
31
31
  "@atlaskit/editor-prosemirror": "^8.0.0",
32
32
  "@atlaskit/platform-feature-flags": "^2.1.0",
33
33
  "@atlaskit/prosemirror-history": "^1.0.0",
34
- "@atlaskit/tmp-editor-statsig": "^131.0.0",
34
+ "@atlaskit/tmp-editor-statsig": "^132.2.0",
35
35
  "@atlaskit/tokens": "^16.2.0",
36
36
  "@babel/runtime": "^7.0.0",
37
37
  "@codemirror/autocomplete": "6.18.4",
@@ -46,7 +46,8 @@
46
46
  "@xiechao/codemirror-lang-handlebars": "^1.0.4",
47
47
  "bind-event-listener": "^3.0.0",
48
48
  "cm6-graphql": "0.2.0",
49
- "codemirror-lang-elixir": "4.0.0"
49
+ "codemirror-lang-elixir": "4.0.0",
50
+ "codemirror-lang-mermaid": "0.4.0"
50
51
  },
51
52
  "peerDependencies": {
52
53
  "@atlaskit/editor-common": "^116.35.0",
@@ -98,6 +99,9 @@
98
99
  },
99
100
  "platform_editor_code_block_folding_analytics": {
100
101
  "type": "boolean"
102
+ },
103
+ "platform_editor_code_block_mermaid_language": {
104
+ "type": "boolean"
101
105
  }
102
106
  },
103
107
  "devDependencies": {
@@ -1,119 +1,119 @@
1
1
  import { SUPPORTED_LANGUAGES } from '@atlaskit/code/constants';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
 
3
4
  // We expect alias[0] to be used for the ADF attribute, see ED-2813
4
5
  export const DEFAULT_LANGUAGES: (
5
6
  | {
6
- readonly name: 'PHP';
7
7
  readonly alias: readonly ['php', 'php3', 'php4', 'php5'];
8
+ readonly name: 'PHP';
8
9
  readonly value: 'php';
9
10
  }
10
11
  | {
11
- readonly name: 'Java';
12
12
  readonly alias: readonly ['java'];
13
+ readonly name: 'Java';
13
14
  readonly value: 'java';
14
15
  }
15
16
  | {
16
- readonly name: 'CSharp';
17
17
  readonly alias: readonly ['csharp', 'c#'];
18
+ readonly name: 'CSharp';
18
19
  readonly value: 'cs';
19
20
  }
20
21
  | {
21
- readonly name: 'Python';
22
22
  readonly alias: readonly ['python', 'py'];
23
+ readonly name: 'Python';
23
24
  readonly value: 'python';
24
25
  }
25
26
  | {
26
- readonly name: 'JavaScript';
27
27
  readonly alias: readonly ['javascript', 'js'];
28
+ readonly name: 'JavaScript';
28
29
  readonly value: 'javascript';
29
30
  }
30
31
  | {
31
- readonly name: 'Html';
32
32
  readonly alias: readonly ['html'];
33
+ readonly name: 'Html';
33
34
  readonly value: 'xml';
34
35
  }
35
36
  | {
36
- readonly name: 'C++';
37
37
  readonly alias: readonly ['c++', 'cpp', 'clike'];
38
+ readonly name: 'C++';
38
39
  readonly value: 'cpp';
39
40
  }
40
41
  | {
41
- readonly name: 'Ruby';
42
42
  readonly alias: readonly ['ruby', 'rb', 'duby'];
43
+ readonly name: 'Ruby';
43
44
  readonly value: 'ruby';
44
45
  }
45
46
  | {
46
- readonly name: 'Objective-C';
47
47
  readonly alias: readonly ['objective-c', 'objectivec', 'obj-c', 'objc'];
48
+ readonly name: 'Objective-C';
48
49
  readonly value: 'objectivec';
49
50
  }
50
51
  | {
51
- readonly name: 'C';
52
52
  readonly alias: readonly ['c'];
53
+ readonly name: 'C';
53
54
  readonly value: 'cpp';
54
55
  }
55
56
  | {
56
- readonly name: 'Swift';
57
57
  readonly alias: readonly ['swift'];
58
+ readonly name: 'Swift';
58
59
  readonly value: 'swift';
59
60
  }
60
61
  | {
61
- readonly name: 'TeX';
62
62
  readonly alias: readonly ['tex', 'latex'];
63
+ readonly name: 'TeX';
63
64
  readonly value: 'tex';
64
65
  }
65
66
  | {
66
- readonly name: 'Shell';
67
67
  readonly alias: readonly ['shell', 'bash', 'sh', 'ksh', 'zsh'];
68
+ readonly name: 'Shell';
68
69
  readonly value: 'shell';
69
70
  }
70
71
  | {
71
- readonly name: 'Scala';
72
72
  readonly alias: readonly ['scala'];
73
+ readonly name: 'Scala';
73
74
  readonly value: 'scala';
74
75
  }
75
76
  | {
76
- readonly name: 'Go';
77
77
  readonly alias: readonly ['go'];
78
+ readonly name: 'Go';
78
79
  readonly value: 'go';
79
80
  }
80
81
  | {
81
- readonly name: 'ActionScript';
82
82
  readonly alias: readonly ['actionscript', 'actionscript3', 'as'];
83
+ readonly name: 'ActionScript';
83
84
  readonly value: 'actionscript';
84
85
  }
85
86
  | {
86
- readonly name: 'ColdFusion';
87
87
  readonly alias: readonly ['coldfusion'];
88
+ readonly name: 'ColdFusion';
88
89
  readonly value: 'xml';
89
90
  }
90
91
  | {
91
- readonly name: 'JavaFX';
92
92
  readonly alias: readonly ['javafx', 'jfx'];
93
+ readonly name: 'JavaFX';
93
94
  readonly value: 'java';
94
95
  }
95
96
  | {
96
- readonly name: 'VbNet';
97
97
  readonly alias: readonly ['vbnet', 'vb.net', 'vfp', 'clipper', 'xbase'];
98
+ readonly name: 'VbNet';
98
99
  readonly value: 'vbnet';
99
100
  }
100
101
  | {
101
- readonly name: 'JSON';
102
102
  readonly alias: readonly ['json'];
103
+ readonly name: 'JSON';
103
104
  readonly value: 'json';
104
105
  }
105
106
  | {
106
- readonly name: 'MATLAB';
107
107
  readonly alias: readonly ['matlab'];
108
+ readonly name: 'MATLAB';
108
109
  readonly value: 'matlab';
109
110
  }
110
111
  | {
111
- readonly name: 'Groovy';
112
112
  readonly alias: readonly ['groovy'];
113
+ readonly name: 'Groovy';
113
114
  readonly value: 'groovy';
114
115
  }
115
116
  | {
116
- readonly name: 'SQL';
117
117
  readonly alias: readonly [
118
118
  'sql',
119
119
  'postgresql',
@@ -127,321 +127,322 @@ export const DEFAULT_LANGUAGES: (
127
127
  'mysql',
128
128
  'sqlite',
129
129
  ];
130
+ readonly name: 'SQL';
130
131
  readonly value: 'sql';
131
132
  }
132
133
  | {
133
- readonly name: 'R';
134
134
  readonly alias: readonly ['r'];
135
+ readonly name: 'R';
135
136
  readonly value: 'r';
136
137
  }
137
138
  | {
138
- readonly name: 'Perl';
139
139
  readonly alias: readonly ['perl', 'pl'];
140
+ readonly name: 'Perl';
140
141
  readonly value: 'perl';
141
142
  }
142
143
  | {
143
- readonly name: 'Lua';
144
144
  readonly alias: readonly ['lua'];
145
+ readonly name: 'Lua';
145
146
  readonly value: 'lua';
146
147
  }
147
148
  | {
148
- readonly name: 'Pascal';
149
149
  readonly alias: readonly ['pas', 'pascal', 'objectpascal', 'delphi'];
150
+ readonly name: 'Pascal';
150
151
  readonly value: 'pascal';
151
152
  }
152
153
  | {
153
- readonly name: 'XML';
154
154
  readonly alias: readonly ['xml'];
155
+ readonly name: 'XML';
155
156
  readonly value: 'xml';
156
157
  }
157
158
  | {
158
- readonly name: 'TypeScript';
159
159
  readonly alias: readonly ['typescript', 'ts'];
160
+ readonly name: 'TypeScript';
160
161
  readonly value: 'typescript';
161
162
  }
162
163
  | {
163
- readonly name: 'CoffeeScript';
164
164
  readonly alias: readonly ['coffeescript', 'coffee-script', 'coffee'];
165
+ readonly name: 'CoffeeScript';
165
166
  readonly value: 'coffeescript';
166
167
  }
167
168
  | {
168
- readonly name: 'Haskell';
169
169
  readonly alias: readonly ['haskell', 'hs'];
170
+ readonly name: 'Haskell';
170
171
  readonly value: 'haskell';
171
172
  }
172
173
  | {
173
- readonly name: 'Puppet';
174
174
  readonly alias: readonly ['puppet'];
175
+ readonly name: 'Puppet';
175
176
  readonly value: 'puppet';
176
177
  }
177
178
  | {
178
- readonly name: 'Arduino';
179
179
  readonly alias: readonly ['arduino'];
180
+ readonly name: 'Arduino';
180
181
  readonly value: 'arduino';
181
182
  }
182
183
  | {
183
- readonly name: 'Fortran';
184
184
  readonly alias: readonly ['fortran'];
185
+ readonly name: 'Fortran';
185
186
  readonly value: 'fortran';
186
187
  }
187
188
  | {
188
- readonly name: 'Erlang';
189
189
  readonly alias: readonly ['erlang', 'erl'];
190
+ readonly name: 'Erlang';
190
191
  readonly value: 'erlang';
191
192
  }
192
193
  | {
193
- readonly name: 'PowerShell';
194
194
  readonly alias: readonly ['powershell', 'posh', 'ps1', 'psm1'];
195
+ readonly name: 'PowerShell';
195
196
  readonly value: 'powershell';
196
197
  }
197
198
  | {
198
- readonly name: 'Haxe';
199
199
  readonly alias: readonly ['haxe', 'hx', 'hxsl'];
200
+ readonly name: 'Haxe';
200
201
  readonly value: 'haxe';
201
202
  }
202
203
  | {
203
- readonly name: 'Elixir';
204
204
  readonly alias: readonly ['elixir', 'ex', 'exs'];
205
+ readonly name: 'Elixir';
205
206
  readonly value: 'elixir';
206
207
  }
207
208
  | {
208
- readonly name: 'Verilog';
209
209
  readonly alias: readonly ['verilog', 'v'];
210
+ readonly name: 'Verilog';
210
211
  readonly value: 'verilog';
211
212
  }
212
213
  | {
213
- readonly name: 'Rust';
214
214
  readonly alias: readonly ['rust'];
215
+ readonly name: 'Rust';
215
216
  readonly value: 'rust';
216
217
  }
217
218
  | {
218
- readonly name: 'VHDL';
219
219
  readonly alias: readonly ['vhdl'];
220
+ readonly name: 'VHDL';
220
221
  readonly value: 'vhdl';
221
222
  }
222
223
  | {
223
- readonly name: 'Sass';
224
224
  readonly alias: readonly ['sass'];
225
+ readonly name: 'Sass';
225
226
  readonly value: 'less';
226
227
  }
227
228
  | {
228
- readonly name: 'OCaml';
229
229
  readonly alias: readonly ['ocaml'];
230
+ readonly name: 'OCaml';
230
231
  readonly value: 'ocaml';
231
232
  }
232
233
  | {
233
- readonly name: 'Dart';
234
234
  readonly alias: readonly ['dart'];
235
+ readonly name: 'Dart';
235
236
  readonly value: 'dart';
236
237
  }
237
238
  | {
238
- readonly name: 'CSS';
239
239
  readonly alias: readonly ['css'];
240
+ readonly name: 'CSS';
240
241
  readonly value: 'css';
241
242
  }
242
243
  | {
243
- readonly name: 'reStructuredText';
244
244
  readonly alias: readonly ['restructuredtext', 'rst', 'rest'];
245
+ readonly name: 'reStructuredText';
245
246
  readonly value: 'rest';
246
247
  }
247
248
  | {
248
- readonly name: 'Kotlin';
249
249
  readonly alias: readonly ['kotlin'];
250
+ readonly name: 'Kotlin';
250
251
  readonly value: 'kotlin';
251
252
  }
252
253
  | {
253
- readonly name: 'D';
254
254
  readonly alias: readonly ['d'];
255
+ readonly name: 'D';
255
256
  readonly value: 'd';
256
257
  }
257
258
  | {
258
- readonly name: 'Octave';
259
259
  readonly alias: readonly ['octave'];
260
+ readonly name: 'Octave';
260
261
  readonly value: 'matlab';
261
262
  }
262
263
  | {
263
- readonly name: 'QML';
264
264
  readonly alias: readonly ['qbs', 'qml'];
265
+ readonly name: 'QML';
265
266
  readonly value: 'qml';
266
267
  }
267
268
  | {
268
- readonly name: 'Prolog';
269
269
  readonly alias: readonly ['prolog'];
270
+ readonly name: 'Prolog';
270
271
  readonly value: 'prolog';
271
272
  }
272
273
  | {
273
- readonly name: 'FoxPro';
274
274
  readonly alias: readonly ['foxpro', 'purebasic'];
275
+ readonly name: 'FoxPro';
275
276
  readonly value: 'purebasic';
276
277
  }
277
278
  | {
278
- readonly name: 'Scheme';
279
279
  readonly alias: readonly ['scheme', 'scm'];
280
+ readonly name: 'Scheme';
280
281
  readonly value: 'scheme';
281
282
  }
282
283
  | {
283
- readonly name: 'CUDA';
284
284
  readonly alias: readonly ['cuda', 'cu'];
285
+ readonly name: 'CUDA';
285
286
  readonly value: 'cpp';
286
287
  }
287
288
  | {
288
- readonly name: 'Julia';
289
289
  readonly alias: readonly ['julia', 'jl'];
290
+ readonly name: 'Julia';
290
291
  readonly value: 'julia';
291
292
  }
292
293
  | {
293
- readonly name: 'Racket';
294
294
  readonly alias: readonly ['racket', 'rkt'];
295
+ readonly name: 'Racket';
295
296
  readonly value: 'lisp';
296
297
  }
297
298
  | {
298
- readonly name: 'Ada';
299
299
  readonly alias: readonly ['ada', 'ada95', 'ada2005'];
300
+ readonly name: 'Ada';
300
301
  readonly value: 'ada';
301
302
  }
302
303
  | {
303
- readonly name: 'Tcl';
304
304
  readonly alias: readonly ['tcl'];
305
+ readonly name: 'Tcl';
305
306
  readonly value: 'tcl';
306
307
  }
307
308
  | {
308
- readonly name: 'Mathematica';
309
309
  readonly alias: readonly ['mathematica', 'mma', 'nb'];
310
+ readonly name: 'Mathematica';
310
311
  readonly value: 'mathematica';
311
312
  }
312
313
  | {
313
- readonly name: 'Autoit';
314
314
  readonly alias: readonly ['autoit'];
315
+ readonly name: 'Autoit';
315
316
  readonly value: 'autoit';
316
317
  }
317
318
  | {
318
- readonly name: 'StandardML';
319
319
  readonly alias: readonly ['standardmL', 'sml', 'standardml'];
320
+ readonly name: 'StandardML';
320
321
  readonly value: 'sml';
321
322
  }
322
323
  | {
323
- readonly name: 'Objective-J';
324
324
  readonly alias: readonly ['objective-j', 'objectivej', 'obj-j', 'objj'];
325
+ readonly name: 'Objective-J';
325
326
  readonly value: 'objectivec';
326
327
  }
327
328
  | {
328
- readonly name: 'Smalltalk';
329
329
  readonly alias: readonly ['smalltalk', 'squeak', 'st'];
330
+ readonly name: 'Smalltalk';
330
331
  readonly value: 'smalltalk';
331
332
  }
332
333
  | {
333
- readonly name: 'Vala';
334
334
  readonly alias: readonly ['vala', 'vapi'];
335
+ readonly name: 'Vala';
335
336
  readonly value: 'vala';
336
337
  }
337
338
  | {
338
- readonly name: 'LiveScript';
339
339
  readonly alias: readonly ['livescript', 'live-script'];
340
+ readonly name: 'LiveScript';
340
341
  readonly value: 'livescript';
341
342
  }
342
343
  | {
343
- readonly name: 'XQuery';
344
344
  readonly alias: readonly ['xquery', 'xqy', 'xq', 'xql', 'xqm'];
345
+ readonly name: 'XQuery';
345
346
  readonly value: 'xquery';
346
347
  }
347
348
  | {
348
- readonly name: 'PlainText';
349
349
  readonly alias: readonly ['text', 'plaintext'];
350
+ readonly name: 'PlainText';
350
351
  readonly value: 'text';
351
352
  }
352
353
  | {
353
- readonly name: 'Yaml';
354
354
  readonly alias: readonly ['yaml', 'yml'];
355
+ readonly name: 'Yaml';
355
356
  readonly value: 'yaml';
356
357
  }
357
358
  | {
358
- readonly name: 'GraphQL';
359
359
  readonly alias: readonly ['graphql'];
360
+ readonly name: 'GraphQL';
360
361
  readonly value: 'graphql';
361
362
  }
362
363
  | {
363
- readonly name: 'AppleScript';
364
364
  readonly alias: readonly ['applescript'];
365
+ readonly name: 'AppleScript';
365
366
  readonly value: 'applescript';
366
367
  }
367
368
  | {
368
- readonly name: 'Clojure';
369
369
  readonly alias: readonly ['clojure'];
370
+ readonly name: 'Clojure';
370
371
  readonly value: 'clojure';
371
372
  }
372
373
  | {
373
- readonly name: 'Diff';
374
374
  readonly alias: readonly ['diff'];
375
+ readonly name: 'Diff';
375
376
  readonly value: 'diff';
376
377
  }
377
378
  | {
378
- readonly name: 'VisualBasic';
379
379
  readonly alias: readonly ['visualbasic'];
380
+ readonly name: 'VisualBasic';
380
381
  readonly value: 'visual-basic';
381
382
  }
382
383
  | {
383
- readonly name: 'JSX';
384
384
  readonly alias: readonly ['jsx'];
385
+ readonly name: 'JSX';
385
386
  readonly value: 'jsx';
386
387
  }
387
388
  | {
388
- readonly name: 'TSX';
389
389
  readonly alias: readonly ['tsx'];
390
+ readonly name: 'TSX';
390
391
  readonly value: 'tsx';
391
392
  }
392
393
  | {
393
- readonly name: 'SplunkSPL';
394
394
  readonly alias: readonly ['splunk-spl'];
395
+ readonly name: 'SplunkSPL';
395
396
  readonly value: 'splunk-spl';
396
397
  }
397
398
  | {
398
- readonly name: 'Dockerfile';
399
399
  readonly alias: readonly ['docker', 'dockerfile'];
400
+ readonly name: 'Dockerfile';
400
401
  readonly value: 'dockerfile';
401
402
  }
402
403
  | {
403
- readonly name: 'HCL';
404
404
  readonly alias: readonly ['hcl', 'terraform'];
405
+ readonly name: 'HCL';
405
406
  readonly value: 'hcl';
406
407
  }
407
408
  | {
408
- readonly name: 'NGINX';
409
409
  readonly alias: readonly ['nginx'];
410
+ readonly name: 'NGINX';
410
411
  readonly value: 'nginx';
411
412
  }
412
413
  | {
413
- readonly name: 'Protocol Buffers';
414
414
  readonly alias: readonly ['protobuf', 'proto'];
415
+ readonly name: 'Protocol Buffers';
415
416
  readonly value: 'protobuf';
416
417
  }
417
418
  | {
418
- readonly name: 'TOML';
419
419
  readonly alias: readonly ['toml'];
420
+ readonly name: 'TOML';
420
421
  readonly value: 'toml';
421
422
  }
422
423
  | {
423
- readonly name: 'Handlebars';
424
424
  readonly alias: readonly ['handlebars', 'mustache'];
425
+ readonly name: 'Handlebars';
425
426
  readonly value: 'handlebars';
426
427
  }
427
428
  | {
428
- readonly name: 'Gherkin';
429
429
  readonly alias: readonly ['gherkin', 'cucumber'];
430
+ readonly name: 'Gherkin';
430
431
  readonly value: 'gherkin';
431
432
  }
432
433
  | {
433
- readonly name: 'ABAP';
434
434
  readonly alias: readonly ['abap'];
435
+ readonly name: 'ABAP';
435
436
  readonly value: 'abap';
436
437
  }
437
438
  | {
438
- readonly name: 'Markdown';
439
439
  readonly alias: readonly ['markdown'];
440
+ readonly name: 'Markdown';
440
441
  readonly value: 'markdown';
441
442
  }
442
443
  | {
443
- name: string;
444
444
  alias: string[];
445
+ name: string;
445
446
  value: string;
446
447
  }
447
448
  )[] = [{ name: '(None)', alias: ['none'], value: 'none' }, ...SUPPORTED_LANGUAGES];
@@ -453,6 +454,11 @@ const getLanguageName = (languageValue: string): string | undefined => {
453
454
  return undefined;
454
455
  }
455
456
 
457
+ // mermaid is gated out of the shared SUPPORTED_LANGUAGES list, so resolve it here
458
+ if (languageValue === 'mermaid' && fg('platform_editor_code_block_mermaid_language')) {
459
+ return 'Mermaid';
460
+ }
461
+
456
462
  const language = (SUPPORTED_LANGUAGES as readonly Language[]).find((l) => {
457
463
  return l.value === languageValue || (l.alias && (l.alias as string[]).includes(languageValue));
458
464
  });
@@ -2,6 +2,7 @@ import { LanguageDescription, LanguageSupport } from '@codemirror/language';
2
2
  import { languages } from '@codemirror/language-data';
3
3
 
4
4
  import type { LanguageAlias } from '@atlaskit/code';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
5
6
 
6
7
  type LanguageAliasValue = LanguageAlias[0];
7
8
 
@@ -12,6 +13,27 @@ export const mapLanguageToCodeMirror = (
12
13
  if (!language || language === 'none') {
13
14
  return undefined;
14
15
  }
16
+ // mermaid is gated out of the shared SUPPORTED_LANGUAGES list; load its grammar only when the gate is on
17
+ if (language === 'mermaid') {
18
+ if (!fg('platform_editor_code_block_mermaid_language')) {
19
+ return undefined;
20
+ }
21
+ return LanguageDescription.of({
22
+ name: 'Mermaid',
23
+ load() {
24
+ return import(
25
+ /* webpackChunkName: "@atlaskit-internal_@atlaskit/editor-plugin-code-block-advanced-lang-mermaid" */
26
+ 'codemirror-lang-mermaid'
27
+ ).then(
28
+ (m) =>
29
+ // Construct locally (like the Handlebars case) to avoid a type clash between
30
+ // this package's `@codemirror/language` and the copy codemirror-lang-mermaid
31
+ // bundles; equivalent to the package's own `mermaid()`.
32
+ new LanguageSupport(m.mermaidLanguage),
33
+ );
34
+ },
35
+ });
36
+ }
15
37
  switch (language) {
16
38
  case 'markdown':
17
39
  return LanguageDescription.of({