• Got a Tipila, google, windows live or facebook account ?

Here are the changes done to pagedown (wmd) in Tipila to support syntax coloring with google code prettify.

Markdown.Converter.js => function _DoCodeBlocks

codeblock = "<pre class='prettyprint'><code>" + codeblock + "\n</code></pre>";

function => _DoCodeSpans

return m1 + "<code class='prettyprint'>" + c + "</code>";

Markdown.sanitizer.js => add code class='prettyPrint' and pre class='prettyPrint' to basictagwhitelist variable so they won't be filtered out as invalid tags by the sanitizer

new var :

 var basic_tag_whitelist = /^(<\/?(b|blockquote|code|code class='prettyPrint'|del|dd|dl|dt|em|h1|h2|h3|i|kbd|li|ol|p|pre|pre class='prettyPrint'|s|sup|sub|strong|strike|ul)>|<(br|hr)\s?\/?>)$/i;

Markdown.Editor.js =>

Add a call to prettyPrint() function at the end of the makePreviewHtml fucntion (after pushPreviewHtml(text); ). Then the wmd calls the prettyfy function when it renders the preview pane

Prettify.css

add line-height: normal; to pre.prettyprint class to add normal line height for code blocks

1
votes
Login to Tipila