Skip to content

Commit 037ac16

Browse files
committed
feat(editor): use google-modes for syntax highlight
1 parent c0f6795 commit 037ac16

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"babel-plugin-async-to-promises": "^1.0.5",
2424
"ci-publish": "^1.3.1",
2525
"codemirror": "^5.48.4",
26+
"codemirror-grammar-mode": "^0.1.9",
2627
"css-loader": "2.1.1",
2728
"debounce": "^1.2.0",
2829
"deepmerge": "^1.5.0",
@@ -32,7 +33,9 @@
3233
"fast-async": "7",
3334
"flatten": "^1.0.2",
3435
"github-markdown-css": "^3.0.1",
36+
"google_modes": "git+https://github.com/codemirror/google-modes.git",
3537
"html-webpack-plugin": "^3.2.0",
38+
"imports-loader": "^0.8.0",
3639
"is-empty-object": "^1.1.1",
3740
"markdown-it": "^8.4.2",
3841
"markdown-it-highlightjs": "^3.0.0",

src/executable-code/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import 'codemirror/addon/comment/continuecomment'
1515
import 'codemirror/mode/javascript/javascript';
1616
import 'codemirror/mode/shell/shell';
1717
import 'codemirror/mode/swift/swift';
18+
import 'google_modes/dist/kotlin';
1819
import merge from 'deepmerge';
1920
import Set from 'es6-set/polyfill';
2021
import defaultConfig, {API_URLS} from '../config';
@@ -51,7 +52,7 @@ const ATTRIBUTES = {
5152

5253
const MODES = {
5354
JAVA: "text/x-java",
54-
KOTLIN: "text/x-kotlin",
55+
KOTLIN: "google-kotlin",
5556
JS: "text/javascript",
5657
GROOVY: "text/x-groovy",
5758
XML: "text/html",

webpack.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ module.exports = (params = {}) => {
3838
include: path.resolve(__dirname, 'src'),
3939
loader: 'babel-loader'
4040
},
41+
{
42+
test: require.resolve("codemirror-grammar-mode"),
43+
use: "imports-loader?CodeMirror=codemirror"
44+
},
4145
{
4246
test: /\.monk$/,
4347
loader: 'monkberry-loader'

0 commit comments

Comments
 (0)