$(document).ready(function() {
parseMd()
});
function parseMd() {
var GITHUB = 'https://raw.githubusercontent.com/gto76/python-cheatsheet/master/README.md'
jQuery.get(GITHUB, function(text) {
var converter = new showdown.Converter()
html = converter.makeHtml(text)
aDiv = $('#main_container')
nodes = $.parseHTML(html)
aDiv.after(nodes);
insertLinks()
d3.selectAll("code").each(function() { hljs.highlightBlock(this); });
addToc()
});
}
function insertLinks() {
$('h2').each(function() {
aId = $(this).attr('id')
$(this).append('#')
})
}
function addToc() {
headerMain = $('#main')
nodes = $.parseHTML(TOC)
headerMain.before(nodes)
}
var TOC = '
' +
'
ToC = {\n' +
' \'1. Collections\': [List, Dict, Set, Range, Enumerate, Namedtuple, Iterator, Generator],\n' +
' \'2. Types\': [Type, String, Regex, Format, Numbers, Combinatorics, Datetimeᴺᴱᵂ],\n' +
' \'3. Syntax\': [Args, Splat, Inline, Closure, Decorator, Class, Enum, Exceptions],\n' +
' \'4. System\': [Print, Input, Command_Line_Arguments, Open, Pathᴺᴱᵂ, Command_Execution],\n' +
' \'5. Data\': [CSV, JSON, Pickle, SQLite, Bytes, Struct, Array, MemoryView, Deque],\n' +
' \'6. Advanced\': [Threading, Introspection, Metaprograming, Operator, Eval, Coroutine],\n' +
' \'7. Libraries\': [Progress_Bar, Plot, Table, Curses, Loggingᴺᴱᵂ, Scraping, Web, Profile,\n' +
' NumPy, Image, Audio, Basic_Script_Template]\n' +
'}\n' +
'
\n'