Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show line numbers only when showLineNumbers == true #312

Merged

Conversation

AbhyudayaSharma
Copy link
Contributor

@AbhyudayaSharma AbhyudayaSharma commented Oct 2, 2020

After updating to 14.0.0, I started seeing line numbers for code blocks of a single line even when showLineNumbers was unset. One potential walkaround I found was to explicitly set showInlineLineNumbers = false. But this PR fixes the problem with unwrapped lines by only showing line numbers if showLineNumbers == true.

This is how I was using SyntaxHighlighter:

<SyntaxHighlighter language={language || 'text'} style={darcula}>
  {this.props.value}
</SyntaxHighlighter>

Before:
image

After:
image

I think there exists a similar bug when wrapLongLines == true but this PR does not fix that.

Copy link
Collaborator

@simmerer simmerer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this!

@simmerer simmerer merged commit cffc983 into react-syntax-highlighter:master Oct 4, 2020
@AbhyudayaSharma AbhyudayaSharma deleted the line-number-fix branch October 7, 2020 06:44
AbhyudayaSharma added a commit to AbhyudayaSharma/abhyudayasharma.github.io that referenced this pull request Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants