File tree 3 files changed +6
-6
lines changed
3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ var Highlight = React.createClass({
17
17
} ,
18
18
highlightCode : function ( ) {
19
19
var domNode = ReactDOM . findDOMNode ( this ) ;
20
- var nodes = domNode . querySelectorAll ( 'pre code' ) ;
20
+ var nodes = domNode . querySelectorAll ( 'span code' ) ;
21
21
if ( nodes . length > 0 ) {
22
22
for ( var i = 0 ; i < nodes . length ; i = i + 1 ) {
23
23
hljs . highlightBlock ( nodes [ i ] ) ;
@@ -28,7 +28,7 @@ var Highlight = React.createClass({
28
28
if ( this . props . innerHTML ) {
29
29
return < div dangerouslySetInnerHTML = { { __html : this . props . children } } className = { this . props . className || null } > </ div > ;
30
30
} else {
31
- return < pre > < code className = { this . props . className } > { this . props . children } </ code > </ pre > ;
31
+ return < span > < code className = { this . props . className } > { this . props . children } </ code > </ span > ;
32
32
}
33
33
}
34
34
} ) ;
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ var Highlight = React.createClass({
25
25
hljs . registerLanguage ( lang , require ( 'highlight.js/lib/languages/' + lang ) ) ;
26
26
} ) ;
27
27
var domNode = ReactDOM . findDOMNode ( this ) ;
28
- var nodes = domNode . querySelectorAll ( 'pre code' ) ;
28
+ var nodes = domNode . querySelectorAll ( 'span code' ) ;
29
29
if ( nodes . length > 0 ) {
30
30
for ( var i = 0 ; i < nodes . length ; i = i + 1 ) {
31
31
hljs . highlightBlock ( nodes [ i ] ) ;
@@ -36,7 +36,7 @@ var Highlight = React.createClass({
36
36
if ( this . props . innerHTML ) {
37
37
return < div dangerouslySetInnerHTML = { { __html : this . props . children } } className = { this . props . className || null } > </ div > ;
38
38
} else {
39
- return < pre > < code className = { this . props . className } > { this . props . children } </ code > </ pre > ;
39
+ return < span > < code className = { this . props . className } > { this . props . children } </ code > </ span > ;
40
40
}
41
41
}
42
42
} ) ;
Original file line number Diff line number Diff line change @@ -15,14 +15,14 @@ describe('highlight', function() {
15
15
var text = ReactDOMServer . renderToStaticMarkup (
16
16
< Highlight > Some text</ Highlight >
17
17
) ;
18
- expect ( text ) . toBe ( '<pre ><code>Some text</code></pre >' ) ;
18
+ expect ( text ) . toBe ( '<span ><code>Some text</code></span >' ) ;
19
19
} ) ;
20
20
21
21
it ( 'should assign className prop' , function ( ) {
22
22
var text = ReactDOMServer . renderToStaticMarkup (
23
23
< Highlight className = 'html' > Some text</ Highlight >
24
24
) ;
25
- expect ( text ) . toBe ( '<pre ><code class="html">Some text</code></pre >' ) ;
25
+ expect ( text ) . toBe ( '<span ><code class="html">Some text</code></span >' ) ;
26
26
} ) ;
27
27
28
28
it ( 'should accept innerHTML prop' , function ( ) {
You can’t perform that action at this time.
0 commit comments