Skip to content

Commit d0fbb7f

Browse files
committed
Refined loadSummary
1 parent 35aa58e commit d0fbb7f

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

src/app/book/markdown/markdown.service.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -269,12 +269,8 @@ export class MarkdownService {
269269
return _.data.tocSearch.reduce((acc: Array<string>, __: any): Array<string> => {
270270
return __
271271
&& (/\.md$/.test(__.url.split('#')[0]))
272-
&& (acc.findIndex(path => path === (
273-
/^\//.test(__.url.split('#')[0])
274-
? __.url.split('#')[0]
275-
: `/${__.url.split('#')[0]}`
276-
)) < 0)
277-
? [...acc, decodeURI(/^\//.test(__.url.split('#')[0]) ? __.url.split('#')[0] : `/${__.url.split('#')[0]}`)]
272+
&& (acc.findIndex(path => path === resolve('/', decodeURI(__.url.split('#')[0]))) < 0)
273+
? [...acc, resolve('/', decodeURI(__.url.split('#')[0]))]
278274
: acc;
279275
}, []) as Array<string>;
280276
}),

0 commit comments

Comments
 (0)