From 45160cc9abc4c3c798a3992e7dacd90c1d9afb96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Tue, 26 Mar 2019 22:34:45 +0100 Subject: [PATCH] Script.js fix --- web/script.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/web/script.js b/web/script.js index 29360a9..553f6e8 100644 --- a/web/script.js +++ b/web/script.js @@ -5,14 +5,15 @@ $(document).ready(function() { function parseMd() { var GITHUB = 'https://raw.githubusercontent.com/gto76/python-cheatsheet/master/README.md'; jQuery.get(GITHUB, function(text) { - console.log(text) - text = removeMdToc(text); - console.log(text) + // console.log(text) + // text = removeMdToc(text); + // console.log(text) var converter = new showdown.Converter(); html = converter.makeHtml(text); aDiv = $('#main_container'); nodes = $.parseHTML(html); aDiv.after(nodes); + removeOrigToc(); insertLinks(); d3.selectAll("code").each(function() { hljs.highlightBlock(this); }); addToc(); @@ -36,6 +37,13 @@ function removeMdToc(text) { return out.join('\n'); } +function removeOrigToc() { + headerContents = $('#contents') + contentsList = headerContents.next() + headerContents.remove() + contentsList.remove() +} + function insertLinks() { $('h2').each(function() { aId = $(this).attr('id');