Skip to content

Commit

Permalink
fix markdown link parser not handling section links
Browse files Browse the repository at this point in the history
  • Loading branch information
mProjectsCode committed Nov 5, 2024
1 parent f5b0049 commit a2c3166
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 1 deletion.
67 changes: 67 additions & 0 deletions exampleVault/Buttons/In Note Navigation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
## This is a Heading at the Top

```meta-bind-button
label: Scroll to Middle
style: default
actions:
- type: open
link: "[[#This is a Heading in the Middle]]"
newTab: false
```

some

very

long

text

some

very

long

text

## This is a Heading in the Middle

some

very

long

text

some

very

long

text

some

very

long

text

some

very

long

text

## This is a Heading at the Bottom


Some Secion
^section-1
8 changes: 7 additions & 1 deletion packages/core/src/parsers/MarkdownLinkParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ import { isUrl, openURL } from 'packages/core/src/utils/Utils';

const P_MDLinkInner: Parser<[string, string | undefined, string | undefined]> = P.sequence(
P_FilePath, // the file path
P.string('#').then(P.manyNotOf('[]#|^:')).optional(), // the optional heading
P.or(
P.string('#^')
.then(P.manyNotOf('[]#|^:'))
.map(x => '^' + x), // the optional block
P.string('#').then(P.manyNotOf('[]#|^:')), // the optional heading
P.succeed(undefined),
),
P.string('|').then(P.manyNotOf('[]')).optional(), // the optional alias
);

Expand Down

0 comments on commit a2c3166

Please sign in to comment.