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

Function toMarkdownPath

assets/article-cards.js:985–1007  ·  view source on GitHub ↗
(href)

Source from the content-addressed store, hash-verified

983 }
984
985 function toMarkdownPath(href) {
986 var route = '';
987
988 if (href.indexOf('#/') === 0) {
989 route = href.slice(2);
990 } else if (href.indexOf('#/') > -1) {
991 route = href.split('#/')[1];
992 } else if (/\.md(?:$|[?#])/.test(href)) {
993 route = resolveRelativeMarkdownPath(href);
994 }
995
996 route = route.split('?')[0].split('#')[0].replace(/^\/+/, '');
997
998 if (!route) {
999 return '';
1000 }
1001
1002 if (!/\.md$/i.test(route)) {
1003 route += '.md';
1004 }
1005
1006 return route;
1007 }
1008
1009 function toRouteHref(markdownPath) {
1010 return '#/' + markdownPath.replace(/\.md$/i, '').replace(/^\/+/, '');

Callers 4

resolveIndexMarkdownPathFunction · 0.85
toHomeUpdateItemFunction · 0.85
renderFeaturedCardsFunction · 0.85
toArticleItemFunction · 0.85

Calls 1

Tested by

no test coverage detected