Compare commits

..

1 Commits

Author SHA1 Message Date
RamiBerm
068a4ff86e TRA-4422 line numbers fix (#934)
* fix line numbering in body syntax highlighter

* Packages
2022-03-27 16:17:34 +03:00
6 changed files with 3885 additions and 870 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@up9/mizu-common",
"version": "1.0.139",
"version": "1.0.140",
"description": "Made with create-react-library",
"author": "",
"license": "MIT",

View File

@@ -0,0 +1,39 @@
.highlighterContainer
&.fitScreen
pre
max-height: 90vh
overflow: auto
pre
code
font-size: 0.75rem
&:first-child
margin-right: 0.75rem
background: #F7F9FC
.react-syntax-highlighter-line-number
color: rgb(98, 126, 247)
&:last-child
display: block
code.hljs
white-space: pre-wrap
code.hljs:before
counter-reset: listing
.hljsMarkerLine
counter-increment: listing
.hljsMarkerLine:before
content: counter(listing) " "
display: inline-block
width: 3rem
padding-left: auto
margin-left: auto
text-align: right
opacity: .5

View File

@@ -1,49 +0,0 @@
.highlighterContainer {
&.fitScreen {
pre {
max-height: 90vh;
overflow: auto;
}
}
pre {
code {
font-size: 0.75rem;
&:first-child {
margin-right: 0.75rem;
background: #F7F9FC;
.react-syntax-highlighter-line-number {
color: rgb(98, 126, 247);
}
}
&:last-child {
display: block;
}
}
}
}
code.hljs {
white-space: pre-wrap;
}
code.hljs:before {
counter-reset: listing;
}
code.hljs .hljs-marker-line {
counter-increment: listing;
}
code.hljs .hljs-marker-line:before {
content: counter(listing) " ";
display: inline-block;
width: 3rem;
padding-left: auto;
margin-left: auto;
text-align: right;
opacity: .5;
}

View File

@@ -1,7 +1,7 @@
import React from 'react';
import Lowlight from 'react-lowlight'
import 'highlight.js/styles/atom-one-light.css'
import './index.scss';
import styles from './index.module.sass';
import xml from 'highlight.js/lib/languages/xml'
import json from 'highlight.js/lib/languages/json'
@@ -37,11 +37,11 @@ export const SyntaxHighlighter: React.FC<Props> = ({
const markers = showLineNumbers ? code.split("\n").map((item, i) => {
return {
line: i + 1,
className: 'hljs-marker-line'
className: styles.hljsMarkerLine
}
}) : [];
return <div style={{fontSize: ".75rem"}}><Lowlight language={language ? language : ""} value={code} markers={markers}/></div>;
return <div style={{fontSize: ".75rem"}} className={styles.highlighterContainer}><Lowlight language={language ? language : ""} value={code} markers={markers}/></div>;
};
export default SyntaxHighlighter;

4657
ui/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -13,7 +13,7 @@
"@types/jest": "^26.0.22",
"@types/node": "^12.20.10",
"@uiw/react-textarea-code-editor": "^1.4.12",
"@up9/mizu-common": "1.0.139",
"@up9/mizu-common": "1.0.140",
"axios": "^0.25.0",
"core-js": "^3.20.2",
"craco-babel-loader": "^1.0.3",