소스 검색

Merge pull request #6378 from weseek/fix/linker-with-relative-path

fix: Default markdown linker with relative path does not respect the current page path (v5.1.0)
Yuki Takei 3 년 전
부모
커밋
6c4687725b
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 2
      packages/app/src/services/renderer/markdown-it/link-by-relative-path.ts

+ 4 - 2
packages/app/src/services/renderer/markdown-it/link-by-relative-path.ts

@@ -5,14 +5,16 @@ const PATTERN_RELATIVE_PATH = new RegExp(/^(\.{1,2})(\/.*)?$/);
 
 export default class LinkerByRelativePathConfigurer {
 
-  pagePath: string
+  pagePath: string;
 
   constructor(pagePath: string) {
     this.pagePath = pagePath;
   }
 
   // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
-  configure(md, pagePath: string): void {
+  configure(md): void {
+    const pagePath = this.pagePath;
+
     // Remember old renderer, if overridden, or proxy to default renderer
     const defaultRender = md.renderer.rules.link_open || function(tokens, idx, options, env, self) {
       return self.renderToken(tokens, idx, options);