MCPcopy Create free account
hub / github.com/crisxuan/bestJavaer / getCover

Function getCover

assets/article-cards.js:902–926  ·  view source on GitHub ↗
(markdownPath)

Source from the content-addressed store, hash-verified

900 }
901
902 function getCover(markdownPath) {
903 if (coverCache.has(markdownPath)) {
904 return coverCache.get(markdownPath);
905 }
906
907 var request = fetch(markdownPath + '?v=20260531-card-cover', {
908 cache: 'force-cache'
909 })
910 .then(function (response) {
911 if (!response.ok) {
912 return '';
913 }
914
915 return response.text();
916 })
917 .then(function (markdown) {
918 return extractFirstImage(markdown, markdownPath);
919 })
920 .catch(function () {
921 return '';
922 });
923
924 coverCache.set(markdownPath, request);
925 return request;
926 }
927
928 function extractFirstImage(markdown, markdownPath) {
929 var imagePattern = /!\[[^\]]*]\(([^)\s]+)(?:\s+["'][^"']*["'])?\)|<img[^>]+src=["']([^"']+)["'][^>]*>/ig;

Callers 2

renderFeaturedCardFunction · 0.85
renderCardFunction · 0.85

Calls 1

extractFirstImageFunction · 0.85

Tested by

no test coverage detected