Alignment issue when combining CopyBlock and showLineNumbers
See original GitHub issueVersion: 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.
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:
- Created 4 years ago
- Reactions:2
- Comments:7 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey @rob4neo! Thanks! I had no idea people were using this lol 😅
I’ll look into this right away!
@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!