Skip to content

Commit

Permalink
fix github links with line and column
Browse files Browse the repository at this point in the history
  • Loading branch information
souporserious committed May 3, 2024
1 parent 11899a4 commit 58b9bd3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/three-hats-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"mdxts": patch
---

Fixes source links to direct line and column in GitHub.
1 change: 1 addition & 0 deletions packages/mdxts/src/utils/get-git-file-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export function getGitFileUrl(
switch (url.hostname) {
case 'github.com':
fileUrl = `${gitSource}/blob/${gitBranch}/${filePath}`
if (line || column) fileUrl += `?plain=1`
if (line) fileUrl += `#L${line}`
if (column) fileUrl += `:${column}`
break
Expand Down

0 comments on commit 58b9bd3

Please sign in to comment.