Skip to content

Commit

Permalink
Merge pull request #278 from code-hike/line-number-shift-fix
Browse files Browse the repository at this point in the history
Fix line number horizontal shift
  • Loading branch information
pomber authored Aug 28, 2022
2 parents 2d13eae + 59b2af1 commit 9d46d1b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/mdx/src/smooth-code/use-dimensions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function useDimensions(
.trimEnd()
.split(newlineRe)

const originalLineCount = lines.length
const largestLineNumber = Math.max(lines.length, 10)

if (rows) {
// make the lines match the requested number of rows
Expand Down Expand Up @@ -108,7 +108,7 @@ function useDimensions(
<div ref={ref} key={i}>
{lineNumbers ? (
<span className="ch-code-line-number">
_{originalLineCount}
_{largestLineNumber}
</span>
) : undefined}
<div
Expand Down

0 comments on commit 9d46d1b

Please sign in to comment.