Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
1.2k views
in Q2A Core by
The editors we have currently doesn't support syntax highlighting and its really painful to get one working.

Can we have this as core feature?
Q2A version: 1.8
by
markdown editor plugin is already support , shall try it ,,
by
Thanks for the reply, I installed markdown editor . But it doesn't include syntax highlight :(
by
@teju which version are you using? It's included in my plugin: https://github.com/svivian/q2a-markdown-editor

2 Answers

0 votes
by
 
Best answer

I just added highlight.js & got syntax highlight working :)

Thanks @arjunsuresh and @muntaha.dede for help

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.7.0/styles/default.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.7.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>

+2 votes
by
Making it a core feature is nice. But dont think it will be. For ckeditor you can use this:
It comes with MathJax also. Also, download the modified ckeditor from the github link for the editor support. Since this requires a modification to core file, not a plugin, but is quite useful if you need mathjax and code prettify - I also had spent many days trying to fix both.

https://github.com/arjunsuresh/mathjax
by
Thanks for the reply. I tried adding this without luck. I editor will disappear after I replaced ckeditor folder.
I was able to include Q2A Express Editor & works fine. But syntax is highlighted only during editing. Once it is posted, all highlights are gone. Please help
by
Not sure what the issue is, but if you have a working editor, just go to Admin/Layout - add  the MathJax widget on Question Pages or even all pages. Then it should work.
...