mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-08-07 22:45:23 +02:00
update code style
This commit is contained in:
parent
7b78ff85a0
commit
57308285da
6 changed files with 55 additions and 14 deletions
2
public/dist/code-styling.bundle.js
vendored
2
public/dist/code-styling.bundle.js
vendored
File diff suppressed because one or more lines are too long
2
public/dist/code-styling.css
vendored
2
public/dist/code-styling.css
vendored
|
@ -1,2 +1,2 @@
|
||||||
.hljs{display:block;background:#fff;padding:.5em;color:#333;overflow-x:auto}.hljs-comment,.hljs-meta{color:#969896}.hljs-emphasis,.hljs-quote,.hljs-string,.hljs-strong,.hljs-template-variable,.hljs-variable{color:#df5000}.hljs-keyword,.hljs-selector-tag,.hljs-type{color:#a71d5d}.hljs-attribute,.hljs-bullet,.hljs-literal,.hljs-symbol{color:#0086b3}.hljs-name,.hljs-section{color:#63a35c}.hljs-tag{color:#333}.hljs-attr,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-selector-pseudo,.hljs-title{color:#795da3}.hljs-addition{color:#55a532;background-color:#eaffea}.hljs-deletion{color:#bd2c00;background-color:#ffecec}.hljs-link{text-decoration:underline}
|
.hljs{display:block;background:#fff;padding:.5em;color:#333;overflow-x:auto}.hljs-comment,.hljs-meta{color:#969896}.hljs-emphasis,.hljs-quote,.hljs-string,.hljs-strong,.hljs-template-variable,.hljs-variable{color:#df5000}.hljs-keyword,.hljs-selector-tag,.hljs-type{color:#a71d5d}.hljs-attribute,.hljs-bullet,.hljs-literal,.hljs-symbol{color:#0086b3}.hljs-name,.hljs-section{color:#63a35c}.hljs-tag{color:#333}.hljs-attr,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-id,.hljs-selector-pseudo,.hljs-title{color:#795da3}.hljs-addition{color:#55a532;background-color:#eaffea}.hljs-deletion{color:#bd2c00;background-color:#ffecec}.hljs-link{text-decoration:underline}
|
||||||
.diff--added{color:green!important;background-color:rgba(0,128,0,.21)}.diff--removed{color:red!important;background-color:rgba(255,0,0,.21)}
|
.diff{display:inline-block;width:100%}.diff span{color:inherit!important}.diff--added{color:#277030;background-color:#e2fce7}.diff--added:before{content:"+";opacity:.4}.diff--removed{color:#ae363c;background-color:#ffe6e6}.diff--removed:before{content:"-";opacity:.4}
|
||||||
|
|
2
public/dist/main.css
vendored
2
public/dist/main.css
vendored
File diff suppressed because one or more lines are too long
|
@ -48,12 +48,20 @@ export default class CodeStyler {
|
||||||
|
|
||||||
Array.from(codeBlocks).forEach(block => {
|
Array.from(codeBlocks).forEach(block => {
|
||||||
hljs.highlightBlock(block);
|
hljs.highlightBlock(block);
|
||||||
|
this.highlightDiffs(block);
|
||||||
let temp = block.innerHTML.split('\n');
|
|
||||||
|
|
||||||
temp = temp.map(str => str.replace(/^(\+.*)$/ig, '<span class="diff diff--added">$1</span>'));
|
|
||||||
temp = temp.map(str => str.replace(/^(-.*)$/ig, '<span class="diff diff--removed">$1</span>'));
|
|
||||||
block.innerHTML = temp.join('\n');
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Highlight lines started from + or -
|
||||||
|
* @param {Element} block
|
||||||
|
*/
|
||||||
|
highlightDiffs(block){
|
||||||
|
let lines = block.innerHTML.split('\n').map((line, index) => {
|
||||||
|
return line.replace(/^\+(.*)$/ig, '<span class="diff diff--added">$1</span>')
|
||||||
|
.replace(/^-(.*)$/ig, '<span class="diff diff--removed">$1</span>');
|
||||||
|
});
|
||||||
|
|
||||||
|
block.innerHTML = lines.join('\n');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,14 +193,30 @@
|
||||||
font-family: var(--font-mono);
|
font-family: var(--font-mono);
|
||||||
line-height: 1.7em;
|
line-height: 1.7em;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
|
overflow-x: auto;
|
||||||
|
margin: 15px 0;
|
||||||
|
|
||||||
&__content {
|
&__content {
|
||||||
|
display: inline-block !important;
|
||||||
white-space: pre;
|
white-space: pre;
|
||||||
word-wrap: normal;
|
word-wrap: normal;
|
||||||
overflow-x: auto;
|
|
||||||
background: transparent !important;
|
background: transparent !important;
|
||||||
padding: 15px !important;
|
padding: 15px !important;
|
||||||
color: #41314e !important;
|
color: #41314e !important;
|
||||||
|
min-width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
.diff {
|
||||||
|
margin: 0 -15px;
|
||||||
|
padding-left: 15px;
|
||||||
|
padding-right: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
small {
|
||||||
|
opacity: 0.4;
|
||||||
|
display: inline-block;
|
||||||
|
width: 40px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.hljs-name,
|
.hljs-name,
|
||||||
|
|
|
@ -1,11 +1,28 @@
|
||||||
.diff {
|
.diff {
|
||||||
|
display: inline-block;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
span {
|
||||||
|
color: inherit !important;
|
||||||
|
}
|
||||||
|
|
||||||
&--added {
|
&--added {
|
||||||
color: green !important;
|
color: #277030;
|
||||||
background-color: rgba(0, 128, 0, 0.21);
|
background-color: #e2fce7;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '+';
|
||||||
|
opacity: 0.4;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&--removed {
|
&--removed {
|
||||||
color: red !important;
|
color: rgb(174, 54, 60);
|
||||||
background-color: rgba(255, 0, 0, 0.21);
|
background-color: rgba(255, 230, 230, 1);
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '-';
|
||||||
|
opacity: 0.4;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue