File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22 white-space : pre;
33 font-family : monospace;
44}
5+
6+ pre ,
7+ .pre {
8+ background : # 222 ;
9+ border : none;
10+ }
Original file line number Diff line number Diff line change @@ -55,7 +55,10 @@ export default class HighlightDemoDemo extends Component {
5555 onChange = { event => this . _debouncedSetState ( 'content' , event . target . value ) } />
5656 </ div >
5757 < label > Output</ label >
58- < Highlight language = { language } >
58+ < Highlight
59+ className = { styles . pre }
60+ language = { language }
61+ >
5962 { content }
6063 </ Highlight >
6164 </ div >
Original file line number Diff line number Diff line change @@ -9,21 +9,23 @@ export default class Highlight extends Component {
99 }
1010
1111 componentDidMount ( ) {
12- highlight . initHighlightingOnLoad ( )
13- highlight . highlightBlock ( findDOMNode ( this ) )
12+ highlight . highlightBlock ( findDOMNode ( this . refs . code ) )
1413 }
1514
1615 componentDidUpdate ( ) {
1716 highlight . initHighlighting . called = false
18- highlight . initHighlighting ( )
17+ highlight . highlightBlock ( findDOMNode ( this . refs . code ) )
1918 }
2019
2120 render ( ) {
2221 const { children, language } = this . props
2322
2423 return (
25- < pre >
26- < code className = { language } >
24+ < pre { ...this . props } >
25+ < code
26+ className = { language }
27+ ref = 'code'
28+ >
2729 { children }
2830 </ code >
2931 </ pre >
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ export default class Application extends React.Component {
2525 </ Highlight >
2626 < p > Choose a highlight.js theme and make sure it's included in your index file.</ p >
2727 < Highlight language = 'html' >
28- < link rel = 'stylesheet' href = 'https://highlightjs.org/static/demo/styles/railscasts.css' />
28+ { ` <link rel='stylesheet' href='https://highlightjs.org/static/demo/styles/railscasts.css' />` }
2929 </ Highlight >
3030 < p > And then use react-highlight.js to display your text like so:</ p >
3131 < Highlight language = 'html' >
Original file line number Diff line number Diff line change 33 < head >
44 < title > react-highlight.js</ title >
55 < meta charset ="utf-8 ">
6- < link rel ='stylesheet ' href ='https://highlightjs.org/static/demo/styles/tomorrow-night .css '/>
6+ < link rel ='stylesheet ' href ='https://highlightjs.org/static/demo/styles/railscasts .css '/>
77 < link rel ='stylesheet ' href ='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css '/>
88 </ head >
99 < body >
You can’t perform that action at this time.
0 commit comments