Skip to content

Commit

Permalink
use latest commit hash
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Apr 1, 2019
1 parent d4eb3f8 commit f88029a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion docs/demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var inputDirty = true;
var $activeOutputElem = null;
var search = searchToObject();
var markedVersions = {
master: 'https://cdn.jsdelivr.net/gh/markedjs/marked@master/lib/marked.js'
master: 'https://cdn.jsdelivr.net/gh/markedjs/marked/lib/marked.js'
};
var markedVersionCache = {};
var delayTime = 1;
Expand Down Expand Up @@ -116,6 +116,19 @@ function setInitialVersion() {
$markedVerElem.appendChild(opt);
}
})
.then(function () {
return fetch('https://api.github.com/repos/markedjs/marked/commits')
.then(function (res) {
return res.json();
})
.then(function (json) {
markedVersions['master'] = 'https://cdn.jsdelivr.net/gh/markedjs/marked@' + json[0].sha + '/lib/marked.js';
})
.catch(function () {
// do nothing
// uses url without commit
});
})
.then(function () {
if (search.version) {
if (!markedVersions[search.version]) {
Expand Down

0 comments on commit f88029a

Please sign in to comment.