mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 21:19:37 +08:00
refactor: hightlight code in loader
This commit is contained in:
parent
1e380d306e
commit
c5c1b1339e
@ -71,7 +71,7 @@
|
||||
"warning": "~2.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"antd-md-loader": "0.1.0-beta.13",
|
||||
"antd-md-loader": "0.1.0-beta.14",
|
||||
"atool-build": "^0.5.0",
|
||||
"autoprefixer": "^6.3.3",
|
||||
"babel-cli": "^6.2.0",
|
||||
|
@ -2,7 +2,6 @@ import React from 'react';
|
||||
import { Link } from 'react-router';
|
||||
import { Collapse } from '../../../';
|
||||
import * as utils from '../utils';
|
||||
import hljs from 'highlight.js';
|
||||
|
||||
export default class Demo extends React.Component {
|
||||
constructor(props) {
|
||||
@ -21,10 +20,9 @@ export default class Demo extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { id, meta, intro, code, preview, style, src,
|
||||
expand, pathname } = this.props;
|
||||
const { id, meta, intro, preview, style, src,
|
||||
highlightedCode, highlightedStyle, expand, pathname } = this.props;
|
||||
const introChildren = intro.map(utils.objectToComponent.bind(null, pathname));
|
||||
const highlightedCode = hljs.highlight('javascript', code).value;
|
||||
|
||||
return (
|
||||
<section className="code-box" id={id}>
|
||||
@ -61,7 +59,7 @@ export default class Demo extends React.Component {
|
||||
<div className="highlight">
|
||||
<pre>
|
||||
<code className="css" dangerouslySetInnerHTML={{
|
||||
__html: hljs.highlight('css', style).value,
|
||||
__html: highlightedStyle,
|
||||
}} />
|
||||
</pre>
|
||||
</div> :
|
||||
|
Loading…
Reference in New Issue
Block a user