diff options
author | WingLim <643089849@qq.com> | 2020-12-12 20:14:43 +0300 |
---|---|---|
committer | WingLim <643089849@qq.com> | 2020-12-12 20:14:43 +0300 |
commit | 1406701783ad8ccb54464995acf50d1fa3a337cb (patch) | |
tree | f58de5258030ff92603e60a4b71742d6c6abb63a /assets | |
parent | 29613662a2488617bbc44197e16967f7de7097f5 (diff) |
style: fix code type hint without line number
Diffstat (limited to 'assets')
-rw-r--r-- | assets/js/features.js | 10 | ||||
-rw-r--r-- | assets/sass/components/_highlight.scss | 30 |
2 files changed, 13 insertions, 27 deletions
diff --git a/assets/js/features.js b/assets/js/features.js index c39e21d..76fcaa8 100644 --- a/assets/js/features.js +++ b/assets/js/features.js @@ -53,16 +53,6 @@ renderFootnotes = function () { }); }(); -renderChroma = function () { - const blocks = document.querySelectorAll('.highlight > .chroma'); - for (let i = 0; i < blocks.length; i++) { - const block = blocks[i]; - const afterHighLight = block.querySelector('pre.chroma > code[data-lang]'); - const lang = afterHighLight ? afterHighLight.className : ''; - block.className += ' ' + lang; - } -}(); - renderAnchor = function () { for (let num = 1; num <= 6; num++) { const headers = document.querySelectorAll('.article-post>h' + num); diff --git a/assets/sass/components/_highlight.scss b/assets/sass/components/_highlight.scss index da51ac9..1537ad0 100644 --- a/assets/sass/components/_highlight.scss +++ b/assets/sass/components/_highlight.scss @@ -28,41 +28,37 @@ pre > code { } .highlight > .chroma { - margin: 1em 0; + margin: 0; + padding: 34px 7px 6px; border-radius: 5px; overflow-x: auto; box-shadow: 1px 1px 2px rgba(0,0,0,0.125); position: relative; background: $code-background; - - code { - padding: 0; - } - - table { - position: relative; - border: none; - - &::after { + + code[data-lang]::before { position: absolute; top: 0; right: 0; left: 0; padding: 2px 7px; + width: 100%; + height: 30px; font-size: $code-font-size; + line-height: 1.9; font-weight: bold; color: #b1b1b1; background: darken($code-background, 3%); - content: 'Code'; + content: attr(data-lang); } - } - @each $sign, $text in $code-type-list { - &.#{$sign} > table::after { - content: $text; - } + table { + position: relative; + border: none; } + + .lntd { // Fix code block null line height and // Synchronous gutter and code line highly. |