question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Last line is always blank also causing an extra line number

See original GitHub issue

Hello, thank you for this amazing package. As the title says if write something like this:

$ npm init

It will result in something like that

Screenshot 2022-01-15 at 23 59 52

Is there a way to avoid this issue?

My current configuration is:

<SyntaxHighlighter
  language={match[1]}
  PreTag="div"
  style={a11yDark}
  customStyle={{
    padding: 0,
    borderRadius: 0,
    background: "rgba(0,0,0,0.1)",
  }}
  lineNumberStyle={{
    color: "rgba(255,255,255,0.7)",
    marginRight: "0.5rem",
  }}
  wrapLines={true}
  showLineNumbers={true}
  {...props}
/>

Many thanks.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:9

github_iconTop GitHub Comments

2reactions
hoondevelopercommented, Jan 16, 2022

It seems that MDX rehype is parsing one more \n unnecessarily.

Temporarily I solved it like this:

children = replaceLast(children, '\n', '');
1reaction
itsrennymancommented, Jul 11, 2022

@itsrennyman why did you close the issue as completed? The problem still occurs, we’ve just fixed it temporarily by removing the last \n, but we shouldn’t.

As per the POSIX standard:

3.206 Line A sequence of zero or more non- characters plus a terminating character.

A line should always end with \n, so it’s not really the job of users to remove it, but the one of this library to not display it.

Issue reopened.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is it recommended to have empty line in the end of a ...
Many older tools misbehave if the last line of data in a text file is not terminated with a newline or carriage return...
Read more >
What's the point in adding a new line to the end of a file?
It's not about adding an extra newline at the end of a file, it's about not removing the newline that should be there....
Read more >
Handy one-liners for SED
Output file # should contain no more than one blank line between lines of ... lines are always blank) sed 'n;d' NUMBERING: #...
Read more >
Locate and reset the last cell on a worksheet - Microsoft Support
Empty cells may contain formatting that causes the last cell in a row or column to fall ... Tip: You can also click...
Read more >
“Where did that line come from (and how do I get rid of it ...
What you're experiencing is an autoformatted paragraph border. Microsoft Word, by default, attempts to autoformat certain character sequences into their rich ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found