File tree Expand file tree Collapse file tree 6 files changed +21
-12
lines changed Expand file tree Collapse file tree 6 files changed +21
-12
lines changed Original file line number Diff line number Diff line change 8
8
< link rel ="stylesheet " href ="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css "/>
9
9
< link rel ="stylesheet " href ="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css "/>
10
10
< link rel ="stylesheet " href ="http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css "/>
11
+ < script src ="/node_modules/prismjs-package/themes/prism.css "> </ script >
11
12
< link rel ="stylesheet " href ="/build/styles.css "/>
12
13
</ head >
13
14
< body >
Original file line number Diff line number Diff line change @@ -13,18 +13,23 @@ var _style = require('./style');
13
13
14
14
var _style2 = _interopRequireDefault ( _style ) ;
15
15
16
+ var _prismjsPackage = require ( 'prismjs-package' ) ;
17
+
18
+ var _prismjsPackage2 = _interopRequireDefault ( _prismjsPackage ) ;
19
+
16
20
function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
17
21
18
22
function Change ( props ) {
19
23
var ln1 = props . normal ? props . ln1 : props . ln ;
20
24
var ln2 = props . normal ? props . ln2 : props . ln ;
21
25
22
- // TODO highlight with prism.js
23
26
var html = props . content ;
24
27
25
- // try {
26
- // html = highlight(props.lang, props.content).value;
27
- // } catch (e) {}
28
+ try {
29
+ html = ( 0 , _prismjsPackage2 . default ) ( props . content , props . lang ) ;
30
+ } catch ( e ) {
31
+ console . log ( 'highlight error:' , e ) ;
32
+ }
28
33
29
34
return _react2 . default . createElement (
30
35
'tr' ,
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ function Part(props) {
47
47
48
48
return _react2 . default . createElement (
49
49
'article' ,
50
- null ,
50
+ { className : _style2 . default . diff } ,
51
51
_react2 . default . createElement (
52
52
'header' ,
53
53
null ,
Original file line number Diff line number Diff line change 28
28
"classnames" : " ^2.2.3" ,
29
29
"lang-map" : " ^0.4.0" ,
30
30
"lodash" : " ^4.0.0" ,
31
- "parse-diff" : " ^0.3.1" ,
31
+ "parse-diff" : " ^0.3.2" ,
32
+ "prismjs-package" : " ^0.6.1" ,
32
33
"react" : " ^0.14.6" ,
33
34
"react-dom" : " ^0.14.6"
34
35
},
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import style from './style' ;
3
+ import highlight from 'prismjs-package' ;
3
4
4
5
export default function Change ( props ) {
5
6
const ln1 = props . normal ? props . ln1 : props . ln ;
6
7
const ln2 = props . normal ? props . ln2 : props . ln ;
7
8
8
- // TODO highlight with prism.js
9
- const html = props . content ;
9
+ let html = props . content ;
10
10
11
- // try {
12
- // html = highlight(props.lang, props.content).value;
13
- // } catch (e) {}
11
+ try {
12
+ html = highlight ( props . content , props . lang ) ;
13
+ } catch ( e ) {
14
+ console . log ( 'highlight error:' , e ) ;
15
+ }
14
16
15
17
return (
16
18
< tr className = { props . type } >
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ function Part(props) {
17
17
} ) ;
18
18
19
19
return (
20
- < article >
20
+ < article className = { style . diff } >
21
21
< header >
22
22
< span className = { style . adds } > +++ { additions } </ span >
23
23
< span className = { style . dels } > --- { deletions } </ span >
You can’t perform that action at this time.
0 commit comments