Skip to content

Commit bf5e65b

Browse files
committed
jsdoc: Add class comments to main rendering classes
1 parent 2b670c0 commit bf5e65b

File tree

6 files changed

+71
-0
lines changed

6 files changed

+71
-0
lines changed

src/Obsidian/InlineRenderer.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,20 @@ import { Task } from '../Task/Task';
88
import { TaskLineRenderer } from '../Renderer/TaskLineRenderer';
99
import { TaskLocation } from '../Task/TaskLocation';
1010

11+
/**
12+
* An inline renderer for processing and rendering tasks in the Reading View of an Obsidian file.
13+
*
14+
* This class processes task lists using the same pipeline as the {@link QueryRenderer} while modifying specific components
15+
* like removing the global filter and handling task formatting.
16+
*
17+
* Bug reports associated with this code: (label:"display: reading mode")
18+
* https://github.com/obsidian-tasks-group/obsidian-tasks/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22display%3A%20reading%20mode%22%20label%3A%22type%3A%20bug%22
19+
*
20+
* And probably also: (label:"scope: rendering of tasks")
21+
* https://github.com/obsidian-tasks-group/obsidian-tasks/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22type%3A%20bug%22%20label%3A%22scope%3A%20rendering%20of%20tasks%22
22+
*
23+
* See also {@link LivePreviewExtension} which handles Markdown task lines in Obsidian's Live Preview mode.
24+
*/
1125
export class InlineRenderer {
1226
constructor({ plugin }: { plugin: Plugin }) {
1327
plugin.registerMarkdownPostProcessor(this._markdownPostProcessor.bind(this));

src/Obsidian/LivePreviewExtension.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@ export const newLivePreviewExtension = () => {
1010
return ViewPlugin.fromClass(LivePreviewExtension);
1111
};
1212

13+
/**
14+
* Integrate custom handling of checkbox clicks in the Obsidian editor's Live Preview mode.
15+
*
16+
* This class is primarily designed for checkbox-driven task management in the Obsidian plugin, overriding the default handling behavior.
17+
* It listens for click events, detects checkbox interactions, and updates the document state accordingly.
18+
*
19+
* Bug reports associated with this code: (label:"display: live preview")
20+
* https://github.com/obsidian-tasks-group/obsidian-tasks/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22display%3A%20live%20preview%22%20label%3A%22type%3A%20bug%22
21+
*
22+
* See also {@link InlineRenderer} which handles Markdown task lines in Obsidian's Reading mode.
23+
*/
1324
class LivePreviewExtension implements PluginValue {
1425
private readonly view: EditorView;
1526

src/Renderer/QueryRenderer.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ import type { Task } from '../Task/Task';
2121
import { type BacklinksEventHandler, type EditButtonClickHandler, QueryResultsRenderer } from './QueryResultsRenderer';
2222
import { createAndAppendElement } from './TaskLineRenderer';
2323

24+
/**
25+
* `QueryRenderer` is responsible for rendering queries in Markdown code blocks
26+
* annotated with the 'tasks' processor.
27+
*
28+
* It manages the initialization of query rendering related tasks, processing metadata,
29+
* and adding rendered content to the DOM.
30+
*/
2431
export class QueryRenderer {
2532
private readonly app: App;
2633
private readonly plugin: TasksPlugin;
@@ -64,6 +71,15 @@ export class QueryRenderer {
6471
}
6572
}
6673

74+
/**
75+
* A class that extends {@link MarkdownRenderChild} to render query results dynamically in Obsidian.
76+
*
77+
* This class listens to various Obsidian events such as metadata updates, cache changes, and
78+
* file renames, and re-renders query results when relevant data changes. It supports dynamic
79+
* updates, including reloading query results at midnight to ensure accurate relative date queries.
80+
*
81+
* The generation of HTML to render task lines is done by {@link QueryResultsRenderer}.
82+
*/
6783
class QueryRenderChild extends MarkdownRenderChild {
6884
private readonly app: App;
6985
private readonly plugin: TasksPlugin;

src/Renderer/QueryResultsRenderer.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ import { TaskLineRenderer, type TextRenderer, createAndAppendElement } from './T
2121
export type BacklinksEventHandler = (ev: MouseEvent, task: Task) => Promise<void>;
2222
export type EditButtonClickHandler = (event: MouseEvent, task: Task, allTasks: Task[]) => void;
2323

24+
/**
25+
* Represent the parameters required for rendering a query with {@link QueryResultsRenderer}.
26+
*
27+
* This interface contains all the necessary properties and handlers to manage
28+
* and display query results such as tasks, markdown files, and certain event handlers
29+
* for user interactions, like handling backlinks and editing tasks.
30+
*/
2431
export interface QueryRendererParameters {
2532
allTasks: Task[];
2633
allMarkdownFiles: TFile[];
@@ -29,6 +36,12 @@ export interface QueryRendererParameters {
2936
editTaskPencilClickHandler: EditButtonClickHandler;
3037
}
3138

39+
/**
40+
* The `QueryResultsRenderer` class is responsible for rendering the results
41+
* of a query applied to a set of tasks.
42+
*
43+
* It handles the construction of task groupings and the application of visual styles.
44+
*/
3245
export class QueryResultsRenderer {
3346
/**
3447
* The complete text in the instruction block, such as:

src/Renderer/TaskFieldRenderer.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ import type { TaskLayoutComponent } from '../Layout/TaskLayoutOptions';
44
import { PriorityTools } from '../lib/PriorityTools';
55
import type { Task } from '../Task/Task';
66

7+
/**
8+
* A renderer for individual {@link Task} fields in an HTML context.
9+
*
10+
* This class provides methods to add data attributes and CSS class names to
11+
* HTML elements based on specific task-related components.
12+
*
13+
* See also {@link TaskLineRenderer} which renders all the fields in a task.
14+
*/
715
export class TaskFieldRenderer {
816
private readonly data = taskFieldHTMLData;
917

src/Renderer/TaskLineRenderer.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ export function createAndAppendElement<K extends keyof HTMLElementTagNameMap>(
5353
return el;
5454
}
5555

56+
/**
57+
* `TaskLineRenderer` is responsible for rendering task details as HTML list items with
58+
* various customization options.
59+
*
60+
* It integrates with Obsidian's rendering system and includes functionalities such as priority,
61+
* due dates, and user interactions.
62+
*
63+
* Individual fields in {@link Task} are rendered by {@link TaskFieldRenderer}.
64+
*/
5665
export class TaskLineRenderer {
5766
private readonly textRenderer: TextRenderer;
5867
private readonly obsidianComponent: Component | null;

0 commit comments

Comments
 (0)