Jamroom.net code highlighter

SteveX
SteveX
@ultrajam
10 years ago
2,584 posts
In this here forum, the code highlighter breaks after an apostrophe in a php comment. It fixes itself after an apostophe (in a following comment)



--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)

updated by @ultrajam: 04/20/15 03:15:48PM
michael
@michael
10 years ago
7,791 posts
Took a look at this just now, unfortunately there isn't a great solution.

Currently we use 'smarty' mode from here:
http://codemirror.net/mode/index.html

If I change it to 'javascript' mode then it is formatted correctly, but anything that isn't javascript is just normal text, so smarty and html miss out on formatting.

If we go for 'htmlmixed' then the javascript comes out nicely and so does the HTML but the smarty is grey text. So the best option would be a 'smartymixed' option...... but....that option doesn't exist on the above page.

It does exist here though:
http://shimbamobile.com/wp-content/plugins/LayerSlider/static/codemirror/mode/smartymixed/

but.... it doesnt work as nicely as it should and doesn't fix the javascript comment issue.

So right now, I can't see a better option than what we have sorry. :(

--edit--
semi-related discussion on codemirror's github:
https://github.com/codemirror/CodeMirror/issues/2871
updated by @michael: 03/09/15 02:18:55AM
SteveX
SteveX
@ultrajam
10 years ago
2,584 posts
Ok, it isn't really a worry :)

The comments don't break in the version of codemirror I used for the ujEditorCodeMirror module. I needed to use an up-to-date version and the core version of codemirror was a little older. So maybe it will be fixed in a newer version of codemirror.


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
michael
@michael
10 years ago
7,791 posts
Which setting are you setting it to for ujEditorCodeMirror module?

The settings for the Forum code block are at:
/modules/jrForum/plugins/code.php
{lineNumbers:true,indentWithTabs:true,tabSize:2,matchBrackets:true,readOnly:true,lineWrapping:true,mode:\'smarty\'}); }

I tried out:
* 'javascript' // works perfect for your block of code above, but grey for smarty code.
* 'htmlmixed'
* 'html'
SteveX
SteveX
@ultrajam
10 years ago
2,584 posts
I didn't look at coping with smarty for ujEditorCodeMirror as it only needs to highlight html, it's a very simple module and most of the work was done by the tinymce plugin. But if I can see anyhting obvious I'll post it here.

Forum code highlighting works well for me, I'm totally happy with the way it works now. I just post when I notice something unexpected, not necessarily something that needs to be fixed!


--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
michael
@michael
10 years ago
7,791 posts
now I know about it, it would be nice to work as well as the 'javascript' one works. understand where your coming from though. Thanks for sayin. If it was an easy fix that would have been nice. :)

Tags