Microsoft Dynamics Ax developer's blog

Wednesday, January 16, 2008

Syntax highlighting of X++ code in your blog or site

1. Download highlight.js archive
2. Unpack archive and place it on your site
3. Аdd the following lines at start your html

<script type="text/javascript" src="highlight.js"></script>
<script type="text/javascript">
initHighlightingOnLoad('axapta');
</script>


(or, add html/javascript block with that content in the blogger.com template editor. If you use blogger, you should replace path to the script with full path to site where you uploaded the script like "http://belugin.info/highlight.js")

4. Attach the sample.css stylesheet to your page or add it's contents to the "style" tag of your blogger template

5. Post your code snippets like this:

<pre><code class="Axapta">
// your code here
</code></pre>


PS. You can also use export.html from the archive and skip all steps except 4 - just paste a generated code to your page

No comments: