Skip to content

Commit

Permalink
fixed arrows not being displayed for markdown content
Browse files Browse the repository at this point in the history
  • Loading branch information
Ellpeck committed Aug 9, 2024
1 parent ea4f51b commit 7b189a4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default class SimpleTimeTrackerPlugin extends Plugin {

this.addSettingTab(new SimpleTimeTrackerSettingsTab(this.app, this));

this.registerMarkdownCodeBlockProcessor("simple-time-tracker", async (s, e, i) => {
this.registerMarkdownCodeBlockProcessor("simple-time-tracker", (s, e, i) => {
e.empty();
let component = new MarkdownRenderChild(e);
let tracker = loadTracker(s);
Expand Down
12 changes: 6 additions & 6 deletions src/tracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ function addEditableTableRow(tracker: Tracker, entry: Entry, table: HTMLTableEle

row.createEl("td", { text: entry.endTime || entry.subEntries ? formatDuration(getDuration(entry), settings) : "" });

void renderNameAsMarkdown(nameField.label, getFile, component);
renderNameAsMarkdown(nameField.label, getFile, component);

let expandButton = new ButtonComponent(nameField.label)
.setClass("clickable-icon")
Expand Down Expand Up @@ -394,7 +394,7 @@ function addEditableTableRow(tracker: Tracker, entry: Entry, table: HTMLTableEle
await saveTracker(tracker, getFile(), getSectionInfo());
editButton.setIcon("lucide-pencil");

void renderNameAsMarkdown(nameField.label, getFile, component);
renderNameAsMarkdown(nameField.label, getFile, component);
} else {
nameField.beginEdit(entry.name);
expandButton.buttonEl.style.display = "none";
Expand Down Expand Up @@ -438,10 +438,10 @@ function showConfirm(message: string): Promise<boolean> {
}

function renderNameAsMarkdown(label: HTMLSpanElement, getFile: GetFile, component: Component): void {
MarkdownRenderer.renderMarkdown(label.innerHTML, label, getFile(), component).then(() => {
// rendering wraps it in a paragraph
label.innerHTML = label.querySelector("p").innerHTML;
});
// we don't have to wait here since async code only occurs when a file needs to be loaded (like a linked image)
void MarkdownRenderer.renderMarkdown(label.innerHTML, label, getFile(), component);
// rendering wraps it in a paragraph
label.innerHTML = label.querySelector("p").innerHTML;
}


Expand Down
2 changes: 1 addition & 1 deletion test-vault/test-markdown.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Tested for #tag, *italic*, [link](test2), etc:
```simple-time-tracker
{"entries":[{"name":"`Segment 1`","startTime":"2022-09-27T19:51:18.000Z","endTime":"2022-09-27T19:51:24.000Z"},{"name":"Segment 2","startTime":"2022-09-27T19:51:25.000Z","endTime":"2022-09-27T19:51:26.000Z"},{"name":"#tag Seqment 3 *add* #tag1 text","startTime":null,"endTime":null,"subEntries":[{"name":"Part 1 #tagp1","startTime":"2024-03-17T11:16:00.382Z","endTime":"2024-03-17T11:16:15.966Z","subEntries":null},{"name":"Part 3","startTime":"2024-03-17T11:17:08.000Z","endTime":"2024-03-17T11:17:24.000Z","subEntries":null}],"collapsed":true},{"name":"#tag3 Segment 4","startTime":null,"endTime":null,"subEntries":[{"name":"Part 1 #tag4","startTime":"2024-03-17T12:22:04.000Z","endTime":"2024-03-17T12:22:16.000Z","subEntries":null},{"name":"#tag5 Part 2 *italic*","startTime":"2024-03-17T12:22:20.000Z","endTime":"2024-03-17T12:22:24.000Z","subEntries":null}],"collapsed":true},{"name":"*italic* Segment 5 #tag6 [test2](test2)","startTime":"2024-03-17T12:40:37.000Z","endTime":"2024-03-17T12:40:45.000Z","subEntries":null},{"name":"Segment 6","startTime":"2024-03-27T13:20:56.000Z","endTime":"2024-08-09T16:27:18.029Z","subEntries":null}]}
{"entries":[{"name":"`Segment 1`","startTime":"2022-09-27T19:51:18.000Z","endTime":"2022-09-27T19:51:24.000Z"},{"name":"Segment 2","startTime":"2022-09-27T19:51:25.000Z","endTime":"2022-09-27T19:51:26.000Z"},{"name":"#tag Seqment 3 *add* #tag1 text","startTime":null,"endTime":null,"subEntries":[{"name":"Part 1 #tagp1","startTime":"2024-03-17T11:16:00.382Z","endTime":"2024-03-17T11:16:15.966Z"},{"name":"Part 3","startTime":"2024-03-17T11:17:08.000Z","endTime":"2024-03-17T11:17:24.000Z"}]},{"name":"#tag3 Segment 4","startTime":null,"endTime":null,"subEntries":[{"name":"Part 1 #tag4","startTime":"2024-03-17T12:22:04.000Z","endTime":"2024-03-17T12:22:16.000Z"},{"name":"#tag5 Part 2 *italic*","startTime":"2024-03-17T12:22:20.000Z","endTime":"2024-03-17T12:22:24.000Z"}]},{"name":"*italic* Segment 5 #tag6 [test2](test2)","startTime":"2024-03-17T12:40:37.000Z","endTime":"2024-03-17T12:40:45.000Z"},{"name":"Segment 6","startTime":"2024-03-27T13:20:56.000Z","endTime":"2024-08-09T16:27:18.029Z"}]}
```

0 comments on commit 7b189a4

Please sign in to comment.