' +
+ snippet.map((l, i) =>
+ '
' + (from + i + 1) + '' + esc(l) + '
'
+ ).join('') +
+ '
';
+ };
+
+ if (_snippetCache.has(cacheKey)) {
+ render(_snippetCache.get(cacheKey));
+ return;
+ }
+
+ const serverUrl = REPORT.serverUrl || 'https://github.com';
+ const isGitHubCom = serverUrl === 'https://github.com';
+ const rawUrl = isGitHubCom
+ ? 'https://raw.githubusercontent.com/' + repo + '/' + commit + '/' + path
+ : serverUrl + '/' + repo + '/raw/' + commit + '/' + path;
+ fetch(rawUrl).then(r => {
+ if (!r.ok) throw new Error(r.status);
+ return r.text();
+ }).then(text => {
+ _snippetCache.set(cacheKey, text);
+ render(text);
+ }).catch(() => {
+ container.innerHTML = 'Source unavailable \u2014 could not fetch from repository.
';
+ });
+}
+
const SERVICE_COLORS = {
'test': 'oklch(0.62 0.20 270)',
'http.client': 'oklch(0.62 0.18 235)',
@@ -2256,8 +2338,23 @@