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

  1. $(document).ready(function() {
  2. parseMd()
  3. });
  4. // parseMd()
  5. function parseMd() {
  6. var GITHUB = 'https://raw.githubusercontent.com/gto76/python-cheatsheet/master/README.md'
  7. var RAWGIT = "https://rawgit.com/gto76/python-cheatsheet/master/README.md"
  8. jQuery.get(GITHUB, function(text) {
  9. var converter = new showdown.Converter()
  10. // text = '#hello, markdown!'
  11. // var converter = new showdown.Converter({extensions: ['prettify']})
  12. html = converter.makeHtml(text)
  13. aDiv = $('#bla')
  14. nodes = $.parseHTML(html)
  15. aDiv.after(nodes);
  16. // PR.prettyPrint()
  17. insertLinks()
  18. // $("code").removeClass("xml")
  19. // $.getScript("https://bost.ocks.org/mike/highlight.min.js")
  20. // hljs.configure({
  21. // languages: ['python']
  22. // })
  23. // hljs.initHighlighting();
  24. // d3.selectAll("code:not([class])").classed("javascript", 1);
  25. // d3.selectAll("code").classed("javascript", 1);
  26. d3.selectAll("code").each(function() { hljs.highlightBlock(this); });
  27. });
  28. }
  29. // function parseMd() {
  30. // var GITHUB = 'https://raw.githubusercontent.com/gto76/python-cheatsheet/master/README.md'
  31. // var RAWGIT = "https://rawgit.com/gto76/python-cheatsheet/master/README.md"
  32. // jQuery.get(GITHUB, function(text) {
  33. // var converter = new showdown.Converter({extensions: ['prettify']})
  34. // // text = '#hello, markdown!'
  35. // html = converter.makeHtml(text)
  36. // aDiv = $('#bla')
  37. // nodes = $.parseHTML(html)
  38. // aDiv.after(nodes);
  39. // PR.prettyPrint()
  40. // insertLinks()
  41. // });
  42. // }
  43. function insertLinks() {
  44. $('h2').each(function() {
  45. // title = $(this).text()
  46. aId = $(this).attr('id')
  47. // titleNoSpace = title.replace(" ", "-");
  48. $(this).append('<a href="#'+aId+'" name="'+aId+'">#</a>')
  49. })
  50. }