Skip to content

Commit

Permalink
[FIX] Include link parsing for Review context (st3v3nmw#964)
Browse files Browse the repository at this point in the history
* Include link parsing

* Fix linting
  • Loading branch information
4Source authored Jul 20, 2024
1 parent 3024264 commit e3a0146
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/gui/FlashcardReviewView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,17 @@ export class FlashcardReviewView {
private _formatQuestionContextText(questionContext: string[]): string {
const separator: string = " > ";
let result = this._currentNote.file.basename;
if (questionContext.length > 0) {
result += separator + questionContext.join(separator);
}
questionContext.forEach((context) => {
// Check for links trim [[ ]]
if (context.startsWith("[[") && context.endsWith("]]")) {
context = context.replace("[[", "").replace("]]", "");
// Use replacement text if any
if (context.contains("|")) {
context = context.split("|")[1];
}
}
result += separator + context;
});
return result + separator + "...";
}

Expand Down

0 comments on commit e3a0146

Please sign in to comment.