mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 13:01:31 +08:00 
			
		
		
		
	fix(import/markdown): support wikilinks in other elements other than paragraphs
This commit is contained in:
		
							parent
							
								
									4a40b22c9a
								
							
						
					
					
						commit
						8d90231f76
					
				| @ -287,4 +287,10 @@ $$`; | ||||
|         expect(markdownService.renderToHtml(input, "Title")).toStrictEqual(expected); | ||||
|     }); | ||||
| 
 | ||||
|     it("supports wikilink in lists", () => { | ||||
|         const input = `- oh no my banana I bought on [[journal/monday]] has gone off! I’m taking it back to the [[other/shop]] for a refund`; | ||||
|         const expected = `<ul><li>oh no my banana I bought on <a class="reference-link" href="/journal/monday">journal/monday</a> has gone off! I’m taking it back to the <a class="reference-link" href="/other/shop">other/shop</a> for a refund</li></ul>`; | ||||
|         expect(markdownService.renderToHtml(input, "Title")).toStrictEqual(expected); | ||||
|     }); | ||||
| 
 | ||||
| }); | ||||
|  | ||||
| @ -23,9 +23,7 @@ class CustomMarkdownRenderer extends Renderer { | ||||
|     } | ||||
| 
 | ||||
|     override paragraph(data: Tokens.Paragraph): string { | ||||
|         let text = super.paragraph(data).trimEnd(); | ||||
|         text = processWikiLinks(text); | ||||
|         return text; | ||||
|         return super.paragraph(data).trimEnd(); | ||||
|     } | ||||
| 
 | ||||
|     override code({ text, lang }: Tokens.Code): string { | ||||
| @ -117,6 +115,12 @@ class CustomMarkdownRenderer extends Renderer { | ||||
|         return `<blockquote>${body}</blockquote>`; | ||||
|     } | ||||
| 
 | ||||
|     text(token: Tokens.Text | Tokens.Escape): string { | ||||
|         let text = super.text(token); | ||||
|         text = processWikiLinks(text); | ||||
|         return text; | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| function renderToHtml(content: string, title: string) { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran