Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

use latest commit for demo master #1457

Merged
merged 3 commits into from
Apr 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion docs/demo/demo.js
Original file line number Diff line number Diff line change
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