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

Function extractArticleIndex

assets/article-cards.js:546–567  ·  view source on GitHub ↗
(markdown, articleRoot)

Source from the content-addressed store, hash-verified

544 }
545
546 function extractArticleIndex(markdown, articleRoot) {
547 var articles = [];
548 var pattern = /^\s*-\s*(\d{4}-\d{2}-\d{2})\s*-\s*\[([^\]]+)\]\(([^)]+)\)/gm;
549 var match;
550
551 while ((match = pattern.exec(markdown))) {
552 var markdownPath = resolveIndexMarkdownPath(match[3], articleRoot);
553
554 if (!isArticleMarkdown(markdownPath)) {
555 continue;
556 }
557
558 articles.push({
559 date: match[1],
560 href: toRouteHref(markdownPath),
561 markdownPath: markdownPath,
562 title: match[2].trim()
563 });
564 }
565
566 return articles;
567 }
568
569 function resolveIndexMarkdownPath(href, articleRoot) {
570 articleRoot = articleRoot || 'ai-articles';

Callers 1

getArticleIndexFunction · 0.85

Calls 3

resolveIndexMarkdownPathFunction · 0.85
isArticleMarkdownFunction · 0.85
toRouteHrefFunction · 0.85

Tested by

no test coverage detected