File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33< html >
44 < markdown-html
5- version ="1.18.8 "
5+ version ="1.18.9 "
66 author ="PJ568 "
77 repo ="https://github.com/PJ-568/markdown.html "
88 license ="CC BY-SA 4.0 International "
611611 "text/html"
612612 ) ;
613613
614- //// 处理所有以 .md 结尾的链接
615- const mdLinks = linkDoc . querySelectorAll ( 'a[href$=".md"] ' ) ;
614+ //// 处理所有 a 链接
615+ const mdLinks = linkDoc . querySelectorAll ( 'a[href]:not([href=""]) ' ) ;
616616 mdLinks . forEach ( ( link ) => {
617617 const href = link . getAttribute ( "href" ) ;
618618 if ( ! isExternalLink ( href ) && isRelativePath ( href ) ) {
621621 : getPath ( ) + href ;
622622 absolutePath = new URL ( absolutePath , "http://example.com" )
623623 . pathname ;
624- link . setAttribute ( "href" , `?p=${ absolutePath } ` ) ;
624+ if ( absolutePath . endsWith ( ".md" ) ) {
625+ link . setAttribute ( "href" , `?p=${ absolutePath } ` ) ;
626+ } else {
627+ link . setAttribute ( "href" , absolutePath ) ;
628+ }
625629 }
626630 } ) ;
627631
You can’t perform that action at this time.
0 commit comments