Hi, friends.
Sometimes I post answers on topics here.
And often my answers contain source code samples.
Althrough default reply editor on this forum supports code insertion, it requires each line to be prepended with 4 spaces:
This is the sample
And, because that editor is a basic textarea, you have two options to format source code in your posts properly:
- Manually copy and paste 4 spaces in the beginning of each line;
- Use external text editor to do that
I’ve tried both of these options and can say they are bad
So I made a better solution. It is a short bookmarklet that adds TAB, SHIFT+TAB and auto indenting support into forums editor:
##How to install and use
- Copy that code:
javascript:$.getScript(‘https://cdn.jsdelivr.net/taboverride/4.0.2/taboverride.min.js’,function(){var t=$(‘#wmd-input’).css(‘background’, ‘#e5fff0’);tabOverride.tabSize(4);tabOverride.set(t.get(0));});
-
Add new bookmark in your browser and set that copied code as bookmark URL.
-
When you have reply editor opened - click and run your bookmark. Textarea should become green, as shown in demo above. After that you can use TAB and SHIFT+TAB.
Based on TabOverride lib by Bill Bryant.