Posting Code in Your Forum

classic Classic list List threaded Threaded
1 message Options
GregChapman GregChapman
Reply | Threaded
Open this post in threaded view
|

Posting Code in Your Forum

This post was updated on .
Nabble Support has a feature installed in the "Raw text" facility that is very useful for those whose forums share programming code. It allows users to have the code appear in a pop-up window. This makes it easy to use CTRL-A, CTRL-C to copy the text before pasting it elsewhere.

When posting in Nabble Support simply add the arguments:
name="code" class="xml"
to the opening RAW tag then, instead of appearing like this in your post:
<override_macro name="can_delete" requires="user" dot_parameter="node_attr">
    <n.is_site_admin/>
</override_macro>
it appears with syntax highlighting and line numbering like this:
<override_macro name="can_delete" requires="user" dot_parameter="node_attr">
    <n.is_site_admin/>
</override_macro>
}
and, when you click on the "view plain" link, the pop-up window appears:

Pop-Up window
To achieve this in your own forum:

1. Download the two files linked below which are copies taken from Nabble Support.
(If you prefer, use the term "highlighter" to find the originals in Nabble Support's macro search facility):
syntax_highlighter.naml
nabble_footer.naml

2. In your forum find the macro "nabble_footer" and set the contents of the file "nabble_footer.naml" to over-ride it.

3. Go to Advanced Editor create file "syntax_highlighter" and paste in the contents of "syntax_highlighter.naml" file.

4. From your forum Home page following the links:
Options > Application > Change appearance > CSS
and paste in the CCS code found within the shCC macro (found in the file "syntax_highlighter.naml")

Note: Step 4 is a bit of a work-around. So far this is the only simple way I have found of making the highlighter CSS code accessible to an individual forum.)

If you are able to supply a better solution to my work-around, you might also be able to provide ideas for installing the latest version of syntax highlighter which is now available at:
http://alexgorbatchev.com/SyntaxHighlighter/
and not the location found via the "?" link.

Greg