@@ -14,7 +14,8 @@ export class Link {
1414 }
1515
1616 /**
17- * Return the original Markdown.
17+ * Return the original Markdown, exactly as specified in the original markdown.
18+ * For "[ab](cd.md)", it would return "[ab](cd.md)".
1819 *
1920 * See also {@link markdown}
2021 */
@@ -26,6 +27,11 @@ export class Link {
2627 * This is like {@link originalMarkdown}, but will also work for heading-only links
2728 * when viewed in files other than the one containing the original link.
2829 *
30+ * For "[ab](cd.md)" it would return "[ab](cd.md)".
31+ * For "[#heading](cd.md)" in file "de.md" it would return "[de#heading](cd.md)".
32+ *
33+ * This is needed if using links in Tasks group headings if any of your task files have
34+ * links to headings in their same file.
2935 * See also {@link originalMarkdown}
3036 */
3137 public get markdown ( ) : string {
@@ -38,10 +44,26 @@ export class Link {
3844 return `[[${ this . pathContainingLink } ${ this . destination } |${ this . displayText } ]]` ;
3945 }
4046
47+ /**
48+ * Return the destination, exactly as specified in the original markdown.
49+ * For "[ab](cd.md)", it would return "cd.md".
50+ *
51+ * It is not able to supply the full path of the link destination.
52+ * Note that if you have two files called `cd.md`, Tasks does not yet do anything
53+ * to select the closest file of that name.
54+ *
55+ * So if this is used in a link in Obsidian, Obsidian will use its own logic to open the
56+ * "closest" file.
57+ * Obsidian would choose the closest file to where the Tasks query is, as opposed
58+ * to the closest file where the original task Markdown line is.
59+ */
4160 public get destination ( ) : string {
4261 return this . rawLink . link ;
4362 }
4463
64+ /**
65+ * For "[ab](cd.md)", it would return "ab".
66+ */
4567 public get displayText ( ) : string | undefined {
4668 return this . rawLink . displayText ;
4769 }
0 commit comments