Inserting characters
See original GitHub issueI’m seeing unexpected output with JSX in a <pre><code data-trim class="jsx">
block
<pre><code data-trim class="jsx fragment">
return (
<MyComponent
style={{
minHeight:350,
color:'red',
backgroundColor:'black',
width:'36em',
position:'relative',
}}
>
<div
style={{
position: 'absolute',
top: 16,
left: 16,
}}
>
Some stuffs.
</div>
</MyComponent>
)
</code></pre>
is outputting:
return (
<mycomponent style="{{" minheight:350,="" color:'red',="" backgroundcolor:'black',="" width:'36em',="" position:'relative',="" }}="">
<div style="{{" position:="" 'absolute',="" top:="" 16,="" left:="" }}="">
Some stuffs.
</div>
</mycomponent>
)
The line breaks aren’t expected, neither are the equals and quotes, and the lowercasing is undesirable.
I’m using highlight in a reveal.js presentation. My config looks like:
{ src: 'plugin/highlight/highlight.js', async: true, condition: function() { return !!document.querySelector( 'pre code' ); }, callback: function() { hljs.configure({
tabReplace: ' ', // 2 spaces
}); hljs.initHighlightingOnLoad(); } }
Have I missed a configuration setting somewhere?
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Insert ASCII or Unicode Latin-based symbols and characters
Inserting ASCII characters. To insert an ASCII character, press and hold down ALT while typing the character code. For example, to insert the...
Read more >Inserting characters - IBM
To insert one or more characters within data in the entry area: Position the cursor at the character position following the point where...
Read more >How to insert special characters with the keyboard - SupportHost
On Windows, you can enter special characters directly from the keyboard using the numeric keypad. To do this, you must hold down the...
Read more >Three Ways to Insert Special Characters in Microsoft Word
This tutorial shows three ways to insert special characters in Microsoft Word: 1. The Symbol dialog box. 2. Keyboard shortcuts. 3. AutoCorrect.
Read more >Inserting symbols and special characters - Legal Office Guru
Inserting special characters and symbols with Insert > Symbol ... need to insert a character or symbol that's not on your keyboard, go...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Spot on! The
<code>
tag is not special in HTML, it doesn’t change the escaping rules and you can have arbitrary markup within it as with any other HTML tag. If you want your JSX snippet to be displayed literally (with or without highlighting) you should escape angle brackets with<
and>
.(BTW,
class="jsx"
doesn’t mean anything to highlight.js as we don’t have a separate “jsx” language, instead we have JavaScript that does recognize JSX/E4X markup.)I see now. Can’t believe I got caught by such a basic concept! Thanks for taking the time to set me straight!