Skip to content

Commit f0719fa

Browse files
committed
πŸ› Fix off-by-one in API "View code" source links
`@deno/doc` v2 changed `Location.line` from 1-indexed to 0-indexed (deno_doc #150/#777). GitHub's `#L<n>` anchor is 1-indexed, so the source links generated in package.ts / package/node.ts pointed one line above the symbol's declaration. Add `+ 1`.
1 parent d74b4a5 commit f0719fa

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

β€Žwww/lib/package.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ function* initPackage(
178178
path,
179179
fileURLToPath(section.declaration.location.filename),
180180
)
181-
}#L${section.declaration.location.line}`,
181+
}#L${section.declaration.location.line + 1}`,
182182
`${ref.url}/`,
183183
),
184184
},

β€Žwww/lib/package/node.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ export function createNodePackage(
268268
path,
269269
fileURLToPath(section.declaration.location.filename),
270270
)
271-
}#L${section.declaration.location.line}`,
271+
}#L${section.declaration.location.line + 1}`,
272272
`${ref.url}/`,
273273
),
274274
},

0 commit comments

Comments
Β (0)