Syntax Highlighting Not Working
Help! Syntax highlighting is not working for me (see
screenshot)
I've played with preference settings but no luck. :(
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Brett on 03 Aug, 2012 09:46 AM
Syntax highlighting requires code blocks, not inline code spans. I can't tell from your screenshot how you have those marked up, but try putting them on their own line and indenting 5 spaces and see if it works then.
2 Posted by cxiaoji on 03 Aug, 2012 10:20 AM
Thanks for the fast reply. I was using fenced code blocks.
So it works for indent code but not fenced ones - I've tried turn "Convert fenced code blocks" on and off, the results are the same.
I hope I can get the fenced code to work as well since I have a lot of files in this flavor.
My text for this new screenshot:
----
Indent
function onSSload() {
if (document.styleSheets.length<2) setTimeout(onSSLoad,50);
}
Fenced
```
function onSSload() {
if (document.styleSheets.length<2) setTimeout(onSSLoad,50);
}
```
Support Staff 3 Posted by Brett on 03 Aug, 2012 01:16 PM
It's working, there are visible highlights in your screenshot. The next version of Marked does a better job of detecting the language and letting you override it manually. This one appears to just not be seeing that it's javascript.
I'll contact you outside of this thread about the beta.
4 Posted by cxiaoji on 03 Aug, 2012 04:33 PM
You are telling me I cannot use this like on GitHub:
```javascript
arr.range = function(min,max,step) {
if(!step) step=1;
for (var i=min; i<max; i+=step) {
this.push(i);
}
return this;
}
```
There is obviously no syntax highlighting. Not even wrapping, while I've set page width in the preference.
Support Staff 5 Posted by Brett on 03 Aug, 2012 05:20 PM
You don't have fenced code blocks enabled in the screenshot. It won't work without that.
I've already contacted you off-list, but I want to make that clear for anyone else reading this thread. In your previous screenshot there are clearly numbers highlighted in blue, indicating that at least the highlighter is loading. It's just not detecting the right syntax.
Brett closed this discussion on 26 Aug, 2012 08:05 PM.