File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -116,9 +116,24 @@ function setInitialVersion() {
116116 $markedVerElem . appendChild ( opt ) ;
117117 }
118118 } )
119+ . then ( function ( ) {
120+ return fetch ( 'https://api.github.com/repos/markedjs/marked/commits' )
121+ . then ( function ( res ) {
122+ return res . json ( ) ;
123+ } )
124+ . then ( function ( json ) {
125+ markedVersions [ 'master' ] = 'https://cdn.jsdelivr.net/gh/markedjs/marked@' + json [ 0 ] . sha + '/lib/marked.js' ;
126+ } )
127+ . catch ( function ( ) {
128+ // do nothing
129+ // uses url without commit
130+ } ) ;
131+ } )
119132 . then ( function ( ) {
120133 if ( search . version ) {
121- if ( ! markedVersions [ search . version ] ) {
134+ if ( markedVersions [ search . version ] ) {
135+ return search . version ;
136+ } else {
122137 var match = search . version . match ( / ^ ( \w + ) : ( .+ ) $ / ) ;
123138 if ( match ) {
124139 switch ( match [ 1 ] ) {
You can’t perform that action at this time.
0 commit comments