Repository: platers/obsidian-linter (ts)

Issue:
Bug: move-footnotes-to-the-bottom 
## Describe the Bug

A clear and concise description of what the bug is.

## How to Reproduce

``` markdown
xxx[^1]

[^1]:[b](http://b.com)

- [a](http://a.com)
```

after save

actual result:

```
xxx[^1]

- [b](http://b.com)

[^1]:[a](http://a.com)
```


## Expected Behavior


``` markdown
xxx[^1]

- [a](http://a.com)

[^1]:[b](http://b.com)
```

## Screenshots

If applicable, add screenshots to help explain your problem.

## Device

- [x] Desktop
- [ ] Mobile

## Additional Context

Add any other context about the problem here.


Pull request description:
Update Move Footnote Logic to Not Ignore Tags and Links to Prevent Out of Order Values
Fixes #389 

Changes Made:
- Added a test to let us know if we recreate this issue down the road
- Updated the logic for moving footnotes to the bottom to no longer ignore tags or links to make sure that we can properly move links and tags to the bottom of a file when footnotes include them as their content

Patch:
diff --git a/src/rules/move-footnotes-to-the-bottom.ts b/src/rules/move-footnotes-to-the-bottom.ts
index ad047ac..a0cb2fd 100644
--- a/src/rules/move-footnotes-to-the-bottom.ts
+++ b/src/rules/move-footnotes-to-the-bottom.ts
@@ -22,7 +22,7 @@ export default class MoveFootnotesToTheBottom extends RuleBuilder<MoveFootnotesT
     return RuleType.FOOTNOTE;
   }
   apply(text: string, options: MoveFootnotesToTheBottomOptions): string {
-    return ignoreListOfTypes([IgnoreTypes.code, IgnoreTypes.yaml, IgnoreTypes.link, IgnoreTypes.wikiLink, IgnoreTypes.tag], text, (text) => {
+    return ignoreListOfTypes([IgnoreTypes.code, IgnoreTypes.yaml], text, (text) => {
       return moveFootnotesToEnd(text);
     });
   }


Test patch:
diff --git a/__tests__/move-footnotes-to-the-bottom.test.ts b/__tests__/move-footnotes-to-the-bottom.test.ts
index 88e10dd..226c04d 100644
--- a/__tests__/move-footnotes-to-the-bottom.test.ts
+++ b/__tests__/move-footnotes-to-the-bottom.test.ts
@@ -155,6 +155,24 @@ ruleTest({
         [^2]: footnote B (last in document)
       `,
     },
+    {
+      // accounts for https://github.com/platers/obsidian-linter/issues/389
+      testName: 'Make sure that links that are the footnote text get moved to the bottom correctly',
+      before: dedent`
+        xxx[^1]
+
+        [^1]:[b](http://b.com)
+
+        - [a](http://a.com)
+      `,
+      after: dedent`
+        xxx[^1]
+
+        - [a](http://a.com)
+
+        [^1]:[b](http://b.com)
+      `,
+    },
   ],
 });