Search code examples
google-code-prettify

Postach.io and google-code-prettify


Is there a way to use markdown and google-code-prettify library to use together to pretify the my code?

I have been using

``` var s = "hello world!"; ```

which produces <pre><code> </code></pre> HTML markup. But I am unable to add the prettyprint class to it.

I have also tried using basic html markup

<pre class="prettyprint"><code> var s = "hello world!"; </code></pre>

but postach.io seems to remove the pre and code html tags.


Solution

  • I managed to make it work by adding the following lines to the head section of the html template using source editor of postach.io

    <script type='text/javascript'>
        window.exports = { 
            activate : function (a,b,c) {
                $("pre").addClass("prettyprint linenums");
                PR.prettyPrint();
            }
        }
    </script>
    
    <script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?autoload=true&callback=activate"></script>
    

    and my markdown code is

    ´´´ var s = "hello world!";  ´´´