Skip to content

Commit

Permalink
Merge pull request #1457 from UziTech/demo-master-version
Browse files Browse the repository at this point in the history
use latest commit for demo master
  • Loading branch information
joshbruce committed Apr 6, 2019
2 parents 529a8d4 + 9d2c93e commit 69c9e63
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion docs/demo/demo.js
Expand Up @@ -116,9 +116,24 @@ 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]) {
if (markedVersions[search.version]) {
return search.version;
} else {
var match = search.version.match(/^(\w+):(.+)$/);
if (match) {
switch (match[1]) {
Expand Down

0 comments on commit 69c9e63

Please sign in to comment.