Skip to content

Commit 69c9e63

Browse files
authored
Merge pull request #1457 from UziTech/demo-master-version
use latest commit for demo master
2 parents 529a8d4 + 9d2c93e commit 69c9e63

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

docs/demo/demo.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff 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]) {

0 commit comments

Comments
 (0)