Skip to content

Commit ed52508

Browse files
committed
Replaced prismjs with highlightjs
1 parent aac1a45 commit ed52508

7 files changed

Lines changed: 22 additions & 39 deletions

File tree

.babelrc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@
55
["@babel/plugin-proposal-class-properties", { "loose": false }],
66
"@babel/plugin-proposal-optional-chaining",
77
"@babel/plugin-transform-runtime",
8-
["prismjs", {
9-
"languages": ["json", "markup"],
10-
"plugins": ["line-numbers", "show-language"],
11-
"theme": "okaidia",
12-
"css": true
13-
}]
148
],
159
"presets": [
1610
"@babel/preset-flow",

package-lock.json

Lines changed: 14 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"@stoplight/path": "^1.3.2",
3232
"class-autobind-decorator": "^3.0.1",
3333
"classnames": "^2.3.1",
34+
"highlight.js": "^11.3.1",
3435
"immer": "^9.0.6",
3536
"js-yaml": "^4.1.0",
3637
"json-schema-faker": "^0.5.0-rcv.33",
@@ -40,7 +41,6 @@
4041
"mobx-react": "^7.2.0",
4142
"monaco-editor": "^0.27.0",
4243
"openapi3-ts": "^2.0.1",
43-
"prismjs": "^1.25.0",
4444
"prop-types": "^15.7.2",
4545
"react": "^17.0.2",
4646
"react-dnd": "^14.0.3",
@@ -114,7 +114,6 @@
114114
"autoprefixer": "^10.2.5",
115115
"babel-loader": "^8.0.6",
116116
"babel-plugin-lodash": "^3.3.4",
117-
"babel-plugin-prismjs": "^2.0.1",
118117
"buffer": "^6.0.3",
119118
"css-loader": "^5.1.1",
120119
"enzyme-to-json": "^3.6.2",

src/components/Editor/code.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import React, {PureComponent} from 'react';
33
import PropTypes from 'prop-types';
44
import Editor from 'react-simple-code-editor';
5-
import Prism from 'prismjs';
5+
import hljs from 'highlight.js';
66

77
class Code extends PureComponent {
88
constructor(props) {
@@ -43,7 +43,7 @@ class Code extends PureComponent {
4343
preClassName=""
4444
value={value}
4545
highlight={(code) =>
46-
code && Prism.highlight(code, Prism.languages.markup, 'markup')
46+
code && hljs.highlight(code, {language: 'markup'}).value
4747
}
4848
onValueChange={(e) => this._handleChange(e)}
4949
onBlur={(e) => this._handleBlur(e.target.value)}

src/components/Editor/json.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import React, {PureComponent} from 'react';
33
import PropTypes from 'prop-types';
44
import Editor from 'react-simple-code-editor';
5-
import Prism from 'prismjs';
5+
import hljs from 'highlight.js';
66
import {isObject} from 'lodash';
77

88
class Json extends PureComponent {
@@ -65,7 +65,7 @@ class Json extends PureComponent {
6565
preClassName=""
6666
value={value}
6767
highlight={(code) =>
68-
code && Prism.highlight(code, Prism.languages.json, 'json')
68+
code && hljs.highlight(code, {language: 'json'}).value
6969
}
7070
onValueChange={(e) => this._handleChange(e)}
7171
onBlur={(e) => this._handleBlur(e.target.value)}

src/components/Editor/markdown.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, {useState, useEffect} from 'react';
33
import PropTypes from 'prop-types';
44
import classnames from 'classnames';
55
import Editor from 'react-simple-code-editor';
6-
import Prism from 'prismjs';
6+
import hljs from 'highlight.js';
77

88
const Markdown = ({value: initValue, onChange, ...props}) => {
99
const [value, setValue] = useState(initValue || '');
@@ -37,7 +37,7 @@ const Markdown = ({value: initValue, onChange, ...props}) => {
3737
placeholder={props.placeholder || ''}
3838
value={value}
3939
highlight={(code) =>
40-
code && Prism.highlight(code, Prism.languages.markup, 'markup')
40+
code && hljs.highlight(code, {language: 'markdown'}).value
4141
}
4242
onValueChange={(e) => _handleChange(e)}
4343
onBlur={(e) => _handleBlur(e.target.value)}

src/index.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
import React from 'react';
22
import {render} from 'react-dom';
3-
import Prism from 'prismjs';
4-
require('prismjs/components/prism-markup');
5-
require('prismjs/components/prism-json');
6-
7-
Prism.manual = true;
8-
Prism.highlightAll();
9-
3+
import 'highlight.js/styles/monokai.css';
104
import App from './app';
115

126
import './css/overrides.scss';

0 commit comments

Comments
 (0)