Sha256: 0629927cc1977d9fac9d34821bfbe06eead4dd8914aa708a9de0180ef0264f36
Contents?: true
Size: 913 Bytes
Versions: 81
Compression:
Stored size: 913 Bytes
Contents
function load_page(){ $.get( window.location.pathname.replace('.html', '.md'), function(data){ display_page(data) }, 'text' ); } function display_page(content){ content = content.replace(/.md/g, '.html'); renderer = new marked.Renderer(); renderer.heading = function(text, level){ escapedText = text.toLowerCase().replace(/[^\w]+/g, '-'); return '<h' + level + '><a name="' + escapedText + '" class="anchor" href="#' + escapedText + '"><span class="header-link"></span></a>' + text + '</h' + level + '>'; } $('#content').html($('#content').html() + marked(content, {renderer: renderer})); hljs.initHighlighting(); if(window.location.hash){ $('html, body').scrollTop( $("a[name='"+ window.location.hash.replace('#', '') + "']").offset().top ); } } $(document).ready(load_page); $(document).on('page:load', load_page);
Version data entries
81 entries across 81 versions & 2 rubygems