You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

58 lines
1.7 KiB

$(document).ready(function() {
parseMd()
});
// parseMd()
function parseMd() {
var GITHUB = 'https://raw.githubusercontent.com/gto76/python-cheatsheet/master/README.md'
var RAWGIT = "https://rawgit.com/gto76/python-cheatsheet/master/README.md"
jQuery.get(GITHUB, function(text) {
var converter = new showdown.Converter()
// text = '#hello, markdown!'
// var converter = new showdown.Converter({extensions: ['prettify']})
html = converter.makeHtml(text)
aDiv = $('#bla')
nodes = $.parseHTML(html)
aDiv.after(nodes);
// PR.prettyPrint()
insertLinks()
// $("code").removeClass("xml")
// $.getScript("https://bost.ocks.org/mike/highlight.min.js")
// hljs.configure({
// languages: ['python']
// })
// hljs.initHighlighting();
// d3.selectAll("code:not([class])").classed("javascript", 1);
// d3.selectAll("code").classed("javascript", 1);
d3.selectAll("code").each(function() { hljs.highlightBlock(this); });
});
}
// function parseMd() {
// var GITHUB = 'https://raw.githubusercontent.com/gto76/python-cheatsheet/master/README.md'
// var RAWGIT = "https://rawgit.com/gto76/python-cheatsheet/master/README.md"
// jQuery.get(GITHUB, function(text) {
// var converter = new showdown.Converter({extensions: ['prettify']})
// // text = '#hello, markdown!'
// html = converter.makeHtml(text)
// aDiv = $('#bla')
// nodes = $.parseHTML(html)
// aDiv.after(nodes);
// PR.prettyPrint()
// insertLinks()
// });
// }
function insertLinks() {
$('h2').each(function() {
// title = $(this).text()
aId = $(this).attr('id')
// titleNoSpace = title.replace(" ", "-");
$(this).append('<a href="#'+aId+'" name="'+aId+'">#</a>')
})
}