11import type { Moment } from 'moment' ;
2- import { Component , MarkdownRenderer } from 'obsidian' ;
2+ import { type App , Component , MarkdownRenderer } from 'obsidian' ;
33import { GlobalFilter } from '../Config/GlobalFilter' ;
44import { TASK_FORMATS , getSettings } from '../Config/Settings' ;
55import type { QueryLayoutOptions } from '../Layout/QueryLayoutOptions' ;
@@ -21,6 +21,7 @@ import { TaskFieldRenderer } from './TaskFieldRenderer';
2121 * The function used to render a Markdown task line into an existing HTML element.
2222 */
2323export type TextRenderer = (
24+ app : App ,
2425 text : string ,
2526 element : HTMLSpanElement ,
2627 path : string ,
@@ -65,12 +66,14 @@ export function createAndAppendElement<K extends keyof HTMLElementTagNameMap>(
6566 */
6667export class TaskLineRenderer {
6768 private readonly textRenderer : TextRenderer ;
69+ private readonly obsidianApp : App ;
6870 private readonly obsidianComponent : Component | null ;
6971 private readonly parentUlElement : HTMLElement ;
7072 private readonly taskLayoutOptions : TaskLayoutOptions ;
7173 private readonly queryLayoutOptions : QueryLayoutOptions ;
7274
7375 public static async obsidianMarkdownRenderer (
76+ app : App ,
7477 text : string ,
7578 element : HTMLSpanElement ,
7679 path : string ,
@@ -79,7 +82,8 @@ export class TaskLineRenderer {
7982 if ( ! obsidianComponent ) {
8083 return ;
8184 }
82- await MarkdownRenderer . renderMarkdown ( text , element , path , obsidianComponent ) ;
85+
86+ await MarkdownRenderer . render ( app , text , element , path , obsidianComponent ) ;
8387 }
8488
8589 /**
@@ -99,18 +103,21 @@ export class TaskLineRenderer {
99103 */
100104 constructor ( {
101105 textRenderer = TaskLineRenderer . obsidianMarkdownRenderer ,
106+ obsidianApp,
102107 obsidianComponent,
103108 parentUlElement,
104109 taskLayoutOptions,
105110 queryLayoutOptions,
106111 } : {
107112 textRenderer ?: TextRenderer ;
113+ obsidianApp : App ;
108114 obsidianComponent : Component | null ;
109115 parentUlElement : HTMLElement ;
110116 taskLayoutOptions : TaskLayoutOptions ;
111117 queryLayoutOptions : QueryLayoutOptions ;
112118 } ) {
113119 this . textRenderer = textRenderer ;
120+ this . obsidianApp = obsidianApp ;
114121 this . obsidianComponent = obsidianComponent ;
115122 this . parentUlElement = parentUlElement ;
116123 this . taskLayoutOptions = taskLayoutOptions ;
@@ -301,7 +308,7 @@ export class TaskLineRenderer {
301308 // Add some debug output to enable hidden information in the task to be inspected.
302309 description += `<br>🐛 <b>${ task . lineNumber } </b> . ${ task . sectionStart } . ${ task . sectionIndex } . '<code>${ task . originalMarkdown } </code>'<br>'<code>${ task . path } </code>' > '<code>${ task . precedingHeader } </code>'<br>` ;
303310 }
304- await this . textRenderer ( description , span , task . path , this . obsidianComponent ) ;
311+ await this . textRenderer ( this . obsidianApp , description , span , task . path , this . obsidianComponent ) ;
305312
306313 // If the task is a block quote, the block quote wraps the p-tag that contains the content.
307314 // In that case, we need to unwrap the p-tag *inside* the surrounding block quote.
@@ -495,6 +502,7 @@ export class TaskLineRenderer {
495502
496503 const span = createAndAppendElement ( 'span' , li ) ;
497504 await this . textRenderer (
505+ this . obsidianApp ,
498506 listItem . description ,
499507 span ,
500508 listItem . findClosestParentTask ( ) ?. path ?? '' ,
0 commit comments