File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -5,14 +5,15 @@ $(document).ready(function() {
5
5
function parseMd ( ) {
6
6
var GITHUB = 'https://raw.githubusercontent.com/gto76/python-cheatsheet/master/README.md' ;
7
7
jQuery . get ( GITHUB , function ( text ) {
8
- console . log ( text )
9
- text = removeMdToc ( text ) ;
10
- console . log ( text )
8
+ // console.log(text)
9
+ // text = removeMdToc(text);
10
+ // console.log(text)
11
11
var converter = new showdown . Converter ( ) ;
12
12
html = converter . makeHtml ( text ) ;
13
13
aDiv = $ ( '#main_container' ) ;
14
14
nodes = $ . parseHTML ( html ) ;
15
15
aDiv . after ( nodes ) ;
16
+ removeOrigToc ( ) ;
16
17
insertLinks ( ) ;
17
18
d3 . selectAll ( "code" ) . each ( function ( ) { hljs . highlightBlock ( this ) ; } ) ;
18
19
addToc ( ) ;
@@ -36,6 +37,13 @@ function removeMdToc(text) {
36
37
return out . join ( '\n' ) ;
37
38
}
38
39
40
+ function removeOrigToc ( ) {
41
+ headerContents = $ ( '#contents' )
42
+ contentsList = headerContents . next ( )
43
+ headerContents . remove ( )
44
+ contentsList . remove ( )
45
+ }
46
+
39
47
function insertLinks ( ) {
40
48
$ ( 'h2' ) . each ( function ( ) {
41
49
aId = $ ( this ) . attr ( 'id' ) ;
You can’t perform that action at this time.
0 commit comments