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.

Alignment issue when combining CopyBlock and showLineNumbers

See original GitHub issue

Version: react-code-blocks@0.0.7 React Version: react@16.12.0 Browser: Chrome/79.0.3945.88 (Mac OS 10.15)

First of all, great project - exactly what I was looking for!

Unfortunately, when setting showLineNumbers={true} on a CopyBlock, the whole block gets knocked down to below the line numbers.

Screenshot 2020-01-06 at 16 46 24

Code used (after using create-react-app and removing most of the default css styles):

//App.css
.App {
  width: 800px;
  margin: 0 auto;
  margin-top: 30px;
}
//App.js
import React from 'react';
import './App.css';
import { CopyBlock, dracula } from 'react-code-blocks'

const javascriptSnippet = `function toBe() {
  if (Math.random() < 0.5) {
    return true;
  } else {
    return false;
  }
}`;

function App() {
  return (
    <div className="App">
      <CopyBlock
        language='javascript'
        showLineNumbers={true}
        text={javascriptSnippet}
        theme={dracula}
      />
    </div>
  );
}

export default App;

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
rajinwonderlandcommented, Mar 12, 2020

Hey @rob4neo! Thanks! I had no idea people were using this lol 😅

I’ll look into this right away!

2reactions
rajinwonderlandcommented, Jul 9, 2020

@rob4neo here’s a demo with v0.0.8-beta version. By adding a codeBlock prop to the component, the alignment looks weird.

I think it was defaulting before to an inline Code component, which generally doesn’t look great with lineNumbers.

The new v0.0.8 also has a customStyle prop too should you run into any issues!

Let me know if this is still an issue!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Combining probabilistic alignments with read pair information ...
We propose a split-alignment technique that combats the issue of ambiguous alignments by combining information from probabilistic alignment with positional ...
Read more >
Aligning and Combining: - ISEAL Alliance
This alignment is an important prerequisite to sharing or combining data. It also supports comparison and analysis across different datasets, making sure that ......
Read more >
The react-code-blocks from rajinwonderland - Coder Social
Alignment issue when combining CopyBlock and showLineNumbers. Version: react-code-blocks@0.0.7. React Version: react@16.12.0. Browser: Chrome/79.0.3945.88 ...
Read more >
Alignment issues - Studio Help - Google Support
The ad is misaligned or it's shifted in the ad space. Symptoms The ad doesn't look centered in the ad space. This may...
Read more >
Tire Alignment: What You Need to Know
Tire alignment, also known as wheel alignment, can help your tires perform properly and ... for example, probably has an alignment problem.
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