( app: App, task: TaskInfo )
| 5 | import { splitFrontmatterAndBody } from "./helpers"; |
| 6 | |
| 7 | export async function hydrateTaskDetailsFromFile( |
| 8 | app: App, |
| 9 | task: TaskInfo |
| 10 | ): Promise<TaskInfo> { |
| 11 | const file = app.vault.getAbstractFileByPath(task.path); |
| 12 | if (!(file instanceof TFile)) { |
| 13 | return task; |
| 14 | } |
| 15 | |
| 16 | const content = await app.vault.read(file); |
| 17 | const { body } = splitFrontmatterAndBody(content); |
| 18 | |
| 19 | return { |
| 20 | ...task, |
| 21 | details: body.replace(/\r\n/g, "\n").trimEnd(), |
| 22 | }; |
| 23 | } |
no test coverage detected