(href)
| 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(/^\/+/, ''); |
no test coverage detected