diff --git a/CHANGELOG.md b/CHANGELOG.md index a8d6f2d9..4fe078c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,12 +17,13 @@ All notable changes to this project will be documented in this file. - :sparkles: Feat: add details shortcode ([#68](https://github.com/Lruihao/FixIt/issues/68)) - :sparkles: Feat: add markdown support for **title** parameter of the admonition shortcode - :sparkles: Feat: add 9 newly supported social links ([#17](https://github.com/Lruihao/FixIt/issues/17)) -- :sparkles: Feat: update cell-watermark 1.0.3 and CDN support (fontFamily supported) -- :bug: Fix: remove source map of local libraries to avoid 404 error ([#67](https://github.com/Lruihao/FixIt/issues/67)) +- :zap: Perf: enhance highlight feature and fix some css bugs ([#43](https://github.com/Lruihao/FixIt/issues/43)) - :mag: Feat: add 360 and sougou seo support +- :bug: Fix: remove source map of local libraries to avoid 404 error ([#67](https://github.com/Lruihao/FixIt/issues/67)) +- :fire: Feat: remove shortcode cardlink ([#42](https://github.com/Lruihao/FixIt/issues/42)) - :lipstick: Style: add radius of the scrollbar - :pencil2: Style: fix typo *discription* should be **description** ([#60](https://github.com/Lruihao/FixIt/issues/60)) -- :fire: Feat: remove shortcode cardlink ([#42](https://github.com/Lruihao/FixIt/issues/42)) +- :wrench: Chore: update cell-watermark 1.0.3 and CDN support (fontFamily supported) - :wrench: Chore: add atomic-algolia for exampleSite ([#70](https://github.com/Lruihao/FixIt/issues/70)) - **Full Changelog:** [`v0.2.12...v0.2.13`](https://github.com/Lruihao/FixIt/compare/v0.2.12...v0.2.13) diff --git a/assets/css/_mixin/_details.scss b/assets/css/_mixin/_details.scss index 218e6af3..625e4c87 100644 --- a/assets/css/_mixin/_details.scss +++ b/assets/css/_mixin/_details.scss @@ -1,7 +1,7 @@ @mixin details-transition-open { - @include transition(max-height 0.8s cubic-bezier(0, 1, 0, 1) -0.1s); + @include transition(max-height 0.2s cubic-bezier(0, 1, 0, 1) -0.1s); } @mixin details-transition-close { - @include transition(max-height 0.8s cubic-bezier(0.5, 0, 1, 0) 0s); + @include transition(max-height 0.2s cubic-bezier(0.5, 0, 1, 0) 0s); } diff --git a/assets/css/_partial/_single/_code.scss b/assets/css/_partial/_single/_code.scss index cc1fb543..29e91c57 100644 --- a/assets/css/_partial/_single/_code.scss +++ b/assets/css/_partial/_single/_code.scss @@ -1,3 +1,5 @@ +// inline code +// TODO code { display: inline-block; max-width: 100%; @@ -13,12 +15,19 @@ code { } } +// indented code pre { margin: 0; padding: .25rem 0 .25rem .5rem; overflow: auto; @include tab-size(4); + background: $code-background-color; + + [theme=dark] & { + background: $code-background-color-dark; + } + code { padding: 0; } @@ -30,14 +39,6 @@ pre { } } -code, pre, .highlight table, .highlight tr, .highlight td { - background: $code-background-color; - - [theme=dark] & { - background: $code-background-color-dark; - } -} - .highlight, .gist { font-family: $code-font-family; font-size: $code-font-size; @@ -55,6 +56,7 @@ code, pre, .highlight table, .highlight tr, .highlight td { } } +// block fenced code .highlight { line-height: 1.4em; margin: .5rem 0; @@ -85,6 +87,11 @@ code, pre, .highlight table, .highlight tr, .highlight td { .code-title { width: 100%; padding: .4rem; + + .arrow { + padding: 0 .2rem; + @include transition(transform 0.2s ease); + } } .code-title::after { @@ -92,6 +99,24 @@ code, pre, .highlight table, .highlight tr, .highlight td { content: 'Code'; } + .ellipses { + padding: .4rem; + } + + .copy { + display: none; + padding: .4rem; + + &:hover { + cursor: pointer; + color: $global-link-hover-color; + + [theme=dark] & { + color: $global-link-hover-color-dark; + } + } + } + @each $type, $text in $code-type-map { &.#{$type} .code-title::after { content: $text; @@ -99,23 +124,41 @@ code, pre, .highlight table, .highlight tr, .highlight td { } } - .lntd:first-child { - min-width: 1.6rem; - text-align: right; + /* LineTableTD */ + .lntd { + vertical-align: top; + padding: 0; + + // line numbers + &:first-child { + min-width: 1.6rem; + text-align: right; + } + + // code content + &:last-child { + width: 100%; + } } - .lntd:last-child { - width: 100%; + /* LineTable */ + .lntable { + border-spacing: 0; + width: auto; + overflow: auto; + display: block; pre { @include max-content(min-width); } } + /* LineNumbers */ .ln { padding-right: .75rem; } + /* LineHighlight */ .hl { display: block; background-color: darken($code-background-color, 10%); @@ -125,6 +168,7 @@ code, pre, .highlight table, .highlight tr, .highlight td { } } + /* LineNumbersTable */ .ln, .lnt { color: $global-font-secondary-color; @@ -133,29 +177,6 @@ code, pre, .highlight table, .highlight tr, .highlight td { } } - .arrow { - padding: 0 .2rem; - @include transition(transform 0.2s ease); - } - - .ellipses { - padding: .4rem; - } - - .copy { - display: none; - padding: .4rem; - - &:hover { - cursor: pointer; - color: $global-link-hover-color; - - [theme=dark] & { - color: $global-link-hover-color-dark; - } - } - } - .table-wrapper { max-height: 0; overflow-y: hidden; @@ -190,14 +211,14 @@ code, pre, .highlight table, .highlight tr, .highlight td { } } - /* Comment */ .c, - /* CommentHashbang */ .ch, - /* CommentMultiline */ .cm, - /* CommentSingle */ .c1, - /* CommentSpecial */ .cs, - /* CommentPreproc */ .cp, - /* CommentPreprocFile */ .cpf { font-style: italic } - /* GenericUnderline */ .gl { text-decoration: underline } + /* Error */ + .err { + color: $code-error-color; + background-color: $code-error-background-color; + } + + /* GenericEmph */ .ge { font-style: italic } + /* GenericStrong */ .gs { font-weight: bold } @each $class, $color in $code-highlight-color-map { .#{$class} { color: $color; } @@ -210,6 +231,7 @@ code, pre, .highlight table, .highlight tr, .highlight td { } } +// gist shortcode .gist { .gist-file, .gist-data, .gist-meta { border: none; @@ -247,21 +269,21 @@ code, pre, .highlight table, .highlight tr, .highlight td { .pl-vpf, .pl-vpu, .pl-mdr { - color: #aab1bf; + color: #aab1bf; } .pl-mb, .pl-pdb { - font-weight: 700; + font-weight: 700; } .pl-c, .pl-c span, .pl-pdc { - color: #5b6270; - font-style: italic; + color: #5b6270; + font-style: italic; } .pl-sr .pl-cce { - color: #56b5c2; - font-weight: 400; + color: #56b5c2; + font-weight: 400; } .pl-ef, .pl-en, @@ -270,11 +292,11 @@ code, pre, .highlight table, .highlight tr, .highlight td { .pl-kos, .pl-mh .pl-pdh, .pl-mr { - color: #61afef; + color: #61afef; } .pl-ens, .pl-vi { - color: #be5046; + color: #be5046; } .pl-enti, .pl-mai .pl-sf, @@ -285,7 +307,7 @@ code, pre, .highlight table, .highlight tr, .highlight td { .pl-src, .pl-st, .pl-vo { - color: #56b5c2; + color: #56b5c2; } .pl-eoi, .pl-mri, @@ -293,55 +315,55 @@ code, pre, .highlight table, .highlight tr, .highlight td { .pl-pse .pl-s1, .pl-s, .pl-s1 { - color: #97c279; + color: #97c279; } .pl-k, .pl-kolp, .pl-mc, .pl-pde { - color: #c578dd; + color: #c578dd; } .pl-mi, .pl-pdi { - color: #c578dd; - font-style: italic; + color: #c578dd; + font-style: italic; } .pl-mp, .pl-stp { - color: #818896; + color: #818896; } .pl-mdh, .pl-mdi, .pl-mdr { - font-weight: 400; + font-weight: 400; } .pl-mdht, .pl-mi1 { - color: #97c279; - background: #020; + color: #97c279; + background: #020; } .pl-md, .pl-mdhf { - color: #df6b75; - background: #200; + color: #df6b75; + background: #200; } .pl-corl { - color: #df6b75; - text-decoration: underline; + color: #df6b75; + text-decoration: underline; } .pl-ib { - background: #df6b75; + background: #df6b75; } .pl-ii { - background: #e0c184; - color: #fff; + background: #e0c184; + color: #fff; } .pl-iu { - background: #e05151; + background: #e05151; } .pl-ms1 { - color: #aab1bf; - background: #373b41; + color: #aab1bf; + background: #373b41; } .pl-c1, .pl-cn, @@ -357,7 +379,7 @@ code, pre, .highlight table, .highlight tr, .highlight td { .pl-sok, .pl-sv, .pl-mb { - color: #d19965; + color: #d19965; } .pl-enc, .pl-entc, @@ -369,7 +391,7 @@ code, pre, .highlight table, .highlight tr, .highlight td { .pl-stj, .pl-v, .pl-pdb { - color: #e4bf7a; + color: #e4bf7a; } .pl-ent, .pl-entl, @@ -380,7 +402,7 @@ code, pre, .highlight table, .highlight tr, .highlight td { .pl-sol, .pl-mdh, .pl-mdi { - color: #df6b75; + color: #df6b75; } } } diff --git a/assets/css/_variables.scss b/assets/css/_variables.scss index c68c702c..878fbbf5 100644 --- a/assets/css/_variables.scss +++ b/assets/css/_variables.scss @@ -117,6 +117,9 @@ $code-color-dark: #E5BF78 !default; $code-background-color: #f5f5f5 !default; $code-background-color-dark: #272C34 !default; +$code-error-color: #ef6155 !default; +$code-error-background-color: #2f1e2e !default; + $code-info-color: #9c9c9c !default; $code-info-color-dark: #b1b0b0 !default; @@ -181,154 +184,158 @@ $code-type-map: ( // Color map of the code highlight $code-highlight-color-map: ( - /* Parentheses */ 'p': #a9a9b3, - /* Keyword */ 'k': #b501a9, - /* KeywordConstant */ 'kc': #b501a9, - /* KeywordDeclaration */ 'kd': #b501a9, - /* KeywordNamespace */ 'kn': #b501a9, - /* KeywordPseudo */ 'kp': #b501a9, - /* KeywordReserved */ 'kr': #b501a9, - /* KeywordType */ 'kt': #b501a9, - /* Name */ 'n': #333333, - /* NameAttribute */ 'na': #2b77fa, - /* NameBuiltin */ 'nb': #f74840, - /* NameBuiltinPseudo */ 'bp': #f74840, - /* NameClass */ 'nc': #cb8100, - /* NameConstant */ 'no': #2b77fa, - /* NameDecorator */ 'nd': #0086c1, - /* NameEntity */ 'ni': #2b77fa, - /* NameException */ 'ne': #2b77fa, - /* NameFunction */ 'nf': #2b77fa, - /* NameFunctionMagic */ 'fm': #1ccad6, - /* NameLabel */ 'nl': #2b77fa, - /* NameNamespace */ 'nn': #2b77fa, - /* NameOther */ 'nx': #333333, - /* NameProperty */ 'py': #2b77fa, - /* NameTag */ 'nt': #2b77fa, - /* NameVariable */ 'nv': #2b77fa, - /* NameVariableClass */ 'vc': #2b77fa, - /* NameVariableGlobal */ 'vg': #2b77fa, - /* NameVariableInstance */ 'vi': #2b77fa, - /* NameVariableMagic */ 'vm': #2b77fa, - /* Literal */ 'l': #2aa198, - /* LiteralDate */ 'ld': #2aa198, - /* LiteralString */ 's': #24a443, - /* LiteralStringAffix */ 'sa': #24a443, - /* LiteralStringBacktick */ 'sb': #24a443, - /* LiteralStringChar */ 'sc': #24a443, - /* LiteralStringDelimiter */ 'dl': #24a443, - /* LiteralStringDoc */ 'sd': #24a443, - /* LiteralStringDouble */ 's2': #24a443, - /* LiteralStringEscape */ 'se': #24a443, - /* LiteralStringHeredoc */ 'sh': #24a443, - /* LiteralStringInterpol */ 'si': #24a443, - /* LiteralStringOther */ 'sx': #24a443, - /* LiteralStringRegex */ 'sr': #24a443, - /* LiteralStringSingle */ 's1': #24a443, - /* LiteralStringSymbol */ 'ss': #24a443, - /* LiteralNumber */ 'm': #e2893c, - /* LiteralNumberBin */ 'mb': #e2893c, - /* LiteralNumberFloat */ 'mf': #e2893c, - /* LiteralNumberHex */ 'mh': #e2893c, - /* LiteralNumberInteger */ 'mi': #e2893c, - /* LiteralNumberIntegerLong */ 'il': #e2893c, - /* LiteralNumberOct */ 'mo': #e2893c, - /* Operator */ 'o': #f19b04, - /* OperatorWord */ 'ow': #b501a9, - /* Comment */ 'c': #a0a1a8, - /* CommentHashbang */ 'ch': #a0a1a8, - /* CommentMultiline */ 'cm': #a0a1a8, - /* CommentSingle */ 'c1': #a0a1a8, - /* CommentSpecial */ 'cs': #a0a1a8, - /* CommentPreproc */ 'cp': #a0a1a8, - /* CommentPreprocFile */ 'cpf': #a0a1a8, - /* Generic */ 'g': #e72d40, - /* GenericDeleted */ 'gd': #e72d40, - /* GenericEmph */ 'ge': #e72d40, - /* GenericError */ 'gr': #e72d40, - /* GenericHeading */ 'gh': #e72d40, - /* GenericInserted */ 'gi': #e72d40, - /* GenericOutput */ 'go': #e72d40, - /* GenericPrompt */ 'gp': #e72d40, - /* GenericStrong */ 'gs': #e72d40, - /* GenericSubheading */ 'gu': #e72d40, - /* GenericTraceback */ 'gt': #e72d40, - /* TextWhitespace */ 'w': #bbbbbb, + /* Keyword */ 'k': #00a8c8, + /* KeywordConstant */ 'kc': #00a8c8, + /* KeywordDeclaration */ 'kd': #00a8c8, + /* KeywordNamespace */ 'kn': #f92672, + /* KeywordPseudo */ 'kp': #00a8c8, + /* KeywordReserved */ 'kr': #00a8c8, + /* KeywordType */ 'kt': #00a8c8, + /* Name */ 'n': #111111, + /* NameAttribute */ 'na': #75af00, + /* NameBuiltin */ 'nb': #111111, + /* NameBuiltinPseudo */ 'bp': #111111, + /* NameClass */ 'nc': #75af00, + /* NameConstant */ 'no': #00a8c8, + /* NameDecorator */ 'nd': #75af00, + /* NameEntity */ 'ni': #111111, + /* NameException */ 'ne': #75af00, + /* NameFunction */ 'nf': #75af00, + /* NameFunctionMagic */ 'fm': #111111, + /* NameLabel */ 'nl': #111111, + /* NameNamespace */ 'nn': #111111, + /* NameOther */ 'nx': #75af00, + /* NameProperty */ 'py': #111111, + /* NameTag */ 'nt': #f92672, + /* NameVariable */ 'nv': #111111, + /* NameVariableClass */ 'vc': #111111, + /* NameVariableGlobal */ 'vg': #111111, + /* NameVariableInstance */ 'vi': #111111, + /* NameVariableMagic */ 'vm': #111111, + /* Literal */ 'l': #ae81ff, + /* LiteralDate */ 'ld': #d88200, + /* LiteralString */ 's': #d88200, + /* LiteralStringAffix */ 'sa': #d88200, + /* LiteralStringBacktick */ 'sb': #d88200, + /* LiteralStringChar */ 'sc': #d88200, + /* LiteralStringDelimiter */ 'dl': #d88200, + /* LiteralStringDoc */ 'sd': #d88200, + /* LiteralStringDouble */ 's2': #d88200, + /* LiteralStringEscape */ 'se': #8045ff, + /* LiteralStringHeredoc */ 'sh': #d88200, + /* LiteralStringInterpol */ 'si': #d88200, + /* LiteralStringOther */ 'sx': #d88200, + /* LiteralStringRegex */ 'sr': #d88200, + /* LiteralStringSingle */ 's1': #d88200, + /* LiteralStringSymbol */ 'ss': #d88200, + /* LiteralNumber */ 'm': #ae81ff, + /* LiteralNumberBin */ 'mb': #ae81ff, + /* LiteralNumberFloat */ 'mf': #ae81ff, + /* LiteralNumberHex */ 'mh': #ae81ff, + /* LiteralNumberInteger */ 'mi': #ae81ff, + /* LiteralNumberIntegerLong */ 'il': #ae81ff, + /* LiteralNumberOct */ 'mo': #ae81ff, + /* Operator */ 'o': #f92672, + /* OperatorWord */ 'ow': #f92672, + /* Punctuation */ 'p': #111111, + /* Comment */ 'c': #75715e, + /* CommentHashbang */ 'ch': #75715e, + /* CommentMultiline */ 'cm': #75715e, + /* CommentSingle */ 'c1': #75715e, + /* CommentSpecial */ 'cs': #75715e, + /* CommentPreproc */ 'cp': #75715e, + /* CommentPreprocFile */ 'cpf': #75715e, + /* Generic */ 'g': $code-color, + /* GenericDeleted */ 'gd': $code-color, + /* GenericEmph */ 'ge': $code-color, + /* GenericError */ 'gr': $code-color, + /* GenericHeading */ 'gh': $code-color, + /* GenericInserted */ 'gi': #75af00, + /* GenericOutput */ 'go': $code-color, + /* GenericPrompt */ 'gp': $code-color, + /* GenericStrong */ 'gs': $code-color, + /* GenericSubheading */ 'gu': $code-color, + /* GenericTraceback */ 'gt': $code-color, + /* GenericUnderline */ 'gl': $code-color, + /* TextWhitespace */ 'w': $code-color, + /* Other */ 'x': $code-color ) !default; $code-highlight-color-map-dark: ( - /* Parentheses */ 'p': #a9a9b3, - /* Keyword */ 'k': #d371e3, - /* KeywordConstant */ 'kc': #d371e3, - /* KeywordDeclaration */ 'kd': #d371e3, - /* KeywordNamespace */ 'kn': #d371e3, - /* KeywordPseudo */ 'kp': #d371e3, - /* KeywordReserved */ 'kr': #d371e3, - /* KeywordType */ 'kt': #d371e3, - /* Name */ 'n': #a9b2c0, - /* NameAttribute */ 'na': #41b0f5, - /* NameBuiltin */ 'nb': #19b9c4, - /* NameBuiltinPseudo */ 'bp': #ecbf6f, - /* NameClass */ 'nc': #ecbf6f, - /* NameConstant */ 'no': #41b0f5, - /* NameDecorator */ 'nd': #ecbf6f, - /* NameEntity */ 'ni': #41b0f5, - /* NameException */ 'ne': #41b0f5, - /* NameFunction */ 'nf': #41b0f5, - /* NameFunctionMagic */ 'fm': #19b9c4, - /* NameLabel */ 'nl': #41b0f5, - /* NameNamespace */ 'nn': #41b0f5, - /* NameOther */ 'nx': #a9a9b3, - /* NameProperty */ 'py': #41b0f5, - /* NameTag */ 'nt': #41b0f5, - /* NameVariable */ 'nv': #41b0f5, - /* NameVariableClass */ 'vc': #41b0f5, - /* NameVariableGlobal */ 'vg': #41b0f5, - /* NameVariableInstance */ 'vi': #41b0f5, - /* NameVariableMagic */ 'vm': #41b0f5, - /* Literal */ 'l': #2aa198, - /* LiteralDate */ 'ld': #2aa198, - /* LiteralString */ 's': #8cc570, - /* LiteralStringAffix */ 'sa': #8cc570, - /* LiteralStringBacktick */ 'sb': #8cc570, - /* LiteralStringChar */ 'sc': #8cc570, - /* LiteralStringDelimiter */ 'dl': #8cc570, - /* LiteralStringDoc */ 'sd': #8cc570, - /* LiteralStringDouble */ 's2': #8cc570, - /* LiteralStringEscape */ 'se': #8cc570, - /* LiteralStringHeredoc */ 'sh': #8cc570, - /* LiteralStringInterpol */ 'si': #8cc570, - /* LiteralStringOther */ 'sx': #8cc570, - /* LiteralStringRegex */ 'sr': #8cc570, - /* LiteralStringSingle */ 's1': #8cc570, - /* LiteralStringSymbol */ 'ss': #8cc570, - /* LiteralNumber */ 'm': #db985c, - /* LiteralNumberBin */ 'mb': #db985c, - /* LiteralNumberFloat */ 'mf': #db985c, - /* LiteralNumberHex */ 'mh': #db985c, - /* LiteralNumberInteger */ 'mi': #db985c, - /* LiteralNumberIntegerLong */ 'il': #db985c, - /* LiteralNumberOct */ 'mo': #db985c, - /* Operator */ 'o': #ecbf6f, - /* OperatorWord */ 'ow': #d371e3, - /* Comment */ 'c': #7e848f, - /* CommentHashbang */ 'ch': #7e848f, - /* CommentMultiline */ 'cm': #7e848f, - /* CommentSingle */ 'c1': #7e848f, - /* CommentSpecial */ 'cs': #7e848f, - /* CommentPreproc */ 'cp': #7e848f, - /* CommentPreprocFile */ 'cpf': #7e848f, - /* Generic */ 'g': #f16372, - /* GenericDeleted */ 'gd': #f16372, - /* GenericEmph */ 'ge': #f16372, - /* GenericError */ 'gr': #f16372, - /* GenericHeading */ 'gh': #f16372, - /* GenericInserted */ 'gi': #f16372, - /* GenericOutput */ 'go': #f16372, - /* GenericPrompt */ 'gp': #f16372, - /* GenericStrong */ 'gs': #f16372, - /* GenericSubheading */ 'gu': #f16372, - /* GenericTraceback */ 'gt': #f16372, - /* TextWhitespace */ 'w': #bbbbbb, + /* Keyword */ 'k': #66d9ef, + /* KeywordConstant */ 'kc': #66d9ef, + /* KeywordDeclaration */ 'kd': #66d9ef, + /* KeywordNamespace */ 'kn': #f92672, + /* KeywordPseudo */ 'kp': #66d9ef, + /* KeywordReserved */ 'kr': #66d9ef, + /* KeywordType */ 'kt': #66d9ef, + /* Name */ 'n': $code-color-dark, + /* NameAttribute */ 'na': #a6e22e, + /* NameBuiltin */ 'nb': $code-color-dark, + /* NameBuiltinPseudo */ 'bp': $code-color-dark, + /* NameClass */ 'nc': #a6e22e, + /* NameConstant */ 'no': #66d9ef, + /* NameDecorator */ 'nd': #a6e22e, + /* NameEntity */ 'ni': $code-color-dark, + /* NameException */ 'ne': #a6e22e, + /* NameFunction */ 'nf': #a6e22e, + /* NameFunctionMagic */ 'fm': $code-color-dark, + /* NameLabel */ 'nl': $code-color-dark, + /* NameNamespace */ 'nn': $code-color-dark, + /* NameOther */ 'nx': #a6e22e, + /* NameProperty */ 'py': $code-color-dark, + /* NameTag */ 'nt': #f92672, + /* NameVariable */ 'nv': $code-color-dark, + /* NameVariableClass */ 'vc': $code-color-dark, + /* NameVariableGlobal */ 'vg': $code-color-dark, + /* NameVariableInstance */ 'vi': $code-color-dark, + /* NameVariableMagic */ 'vm': $code-color-dark, + /* Literal */ 'l': #ae81ff, + /* LiteralDate */ 'ld': #e6db74, + /* LiteralString */ 's': #e6db74, + /* LiteralStringAffix */ 'sa': #e6db74, + /* LiteralStringBacktick */ 'sb': #e6db74, + /* LiteralStringChar */ 'sc': #e6db74, + /* LiteralStringDelimiter */ 'dl': #e6db74, + /* LiteralStringDoc */ 'sd': #e6db74, + /* LiteralStringDouble */ 's2': #e6db74, + /* LiteralStringEscape */ 'se': #ae81ff, + /* LiteralStringHeredoc */ 'sh': #e6db74, + /* LiteralStringInterpol */ 'si': #e6db74, + /* LiteralStringOther */ 'sx': #e6db74, + /* LiteralStringRegex */ 'sr': #e6db74, + /* LiteralStringSingle */ 's1': #e6db74, + /* LiteralStringSymbol */ 'ss': #e6db74, + /* LiteralNumber */ 'm': #ae81ff, + /* LiteralNumberBin */ 'mb': #ae81ff, + /* LiteralNumberFloat */ 'mf': #ae81ff, + /* LiteralNumberHex */ 'mh': #ae81ff, + /* LiteralNumberInteger */ 'mi': #ae81ff, + /* LiteralNumberIntegerLong */ 'il': #ae81ff, + /* LiteralNumberOct */ 'mo': #ae81ff, + /* Operator */ 'o': #f92672, + /* OperatorWord */ 'ow': #f92672, + /* Punctuation */ 'p': $code-color-dark, + /* Comment */ 'c': #75715e, + /* CommentHashbang */ 'ch': #75715e, + /* CommentMultiline */ 'cm': #75715e, + /* CommentSingle */ 'c1': #75715e, + /* CommentSpecial */ 'cs': #75715e, + /* CommentPreproc */ 'cp': #75715e, + /* CommentPreprocFile */ 'cpf': #75715e, + /* Generic */ 'g': $code-color-dark, + /* GenericDeleted */ 'gd': #f92672, + /* GenericEmph */ 'ge': $code-color-dark, + /* GenericError */ 'gr': $code-color-dark, + /* GenericHeading */ 'gh': $code-color-dark, + /* GenericInserted */ 'gi': #a6e22e, + /* GenericOutput */ 'go': $code-color-dark, + /* GenericPrompt */ 'gp': $code-color-dark, + /* GenericStrong */ 'gs': $code-color-dark, + /* GenericSubheading */ 'gu': #75715e, + /* GenericTraceback */ 'gt': $code-color-dark, + /* GenericUnderline */ 'gl': $code-color-dark, + /* TextWhitespace */ 'w': $code-color-dark, + /* Other */ 'x': $code-color-dark ) !default; // ========== Code ========== // diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 87332230..1c64b865 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -1068,13 +1068,14 @@ enableEmoji = true # Syntax Highlighting (https://gohugo.io/content-management/syntax-highlighting) # 语法高亮设置 (https://gohugo.io/content-management/syntax-highlighting) [markup.highlight] + ########## necessary configuration ########## + # https://github.com/Lruihao/FixIt/issues/43 codeFences = true - guessSyntax = true lineNos = true lineNumbersInTable = true - # false is a necessary configuration (https://github.com/dillonzq/LoveIt/issues/158) - # false 是必要的设置 (https://github.com/dillonzq/LoveIt/issues/158) noClasses = false + ########## necessary configuration ########## + guessSyntax = true # Goldmark is from Hugo 0.60 the default library used for Markdown # Goldmark 是 Hugo 0.60 以来的默认 Markdown 解析库 [markup.goldmark] diff --git a/exampleSite/content/tests/highlight.md b/exampleSite/content/tests/highlight.md new file mode 100644 index 00000000..981210be --- /dev/null +++ b/exampleSite/content/tests/highlight.md @@ -0,0 +1,104 @@ +--- +title: "Highlight Code" +date: 2022-02-27T18:45:22+08:00 +type: 'posts' +draft: true +--- + +`inline code` + +```scss +pre { + margin: 0; + padding: .25rem 0 .25rem .5rem; + overflow: auto; + @include tab-size(4); + + background: $code-background-color; + + [theme=dark] & { + background: $code-background-color-dark; + } + + code { + padding: 0; + } + + img { + min-height: 1em; + max-height: 1.2em; + vertical-align: text-bottom; + } +} +``` + +```go +package main + +import "fmt" + +func main() { + fmt.Println("Hello, World!") +} +``` + +```diff +- theme = "LoveIt" ++ theme = "FixIt" +``` + +```javascript +grunt.initConfig({ + assemble: { + options: { + assets: 'docs/assets', + data: 'src/data/*.{json,yml}', + helpers: 'src/custom-helpers.js', + partials: ['src/partials/**/*.{hbs,md}'] + }, + pages: { + options: { + layout: 'default.hbs' + }, + files: { + './': ['src/templates/pages/index.hbs'] + } + } + } +}; +``` + + ▸ .github/ # GitHub configuration + ▸ _scripts/ # shell commands for hugo project, entrance: hugo_main.sh + ▸ archetypes/ # page archetypes (like scaffolds of archetypes) + ▸ assets/ # css, js, third-party libraries etc. + ▸ content/ # blog source of hugo project + ▸ data/ # blog data (allow: yaml, json, toml), e.g. friends.yml + ▸ i18n/ # i18n translation documents + ▸ layouts/ # page layouts source + ▸ public/ # build directory + ▸ static/ # static files, e.g. favicon.ico + ▸ themes/ # theme submodules + config.toml # configuration of hugo project (like _config.yml of hexo) + +```yaml +# - nickname: 标题 +# avatar: 头像 +# url: 站点 +# description: 描述 +- nickname: Lruihao + avatar: https://gravatar.loli.net/avatar/3f985efb5907ca52944a3cd7edd51606?d=wavatar&v=1.3.10 + url: https://lruihao.cn + description: 不怕萬人阻擋,只怕自己投降 + +``` + +```html +
Lorem ipsum dolor sit amet, graecis denique ei vel, at duo primis mandamus. Et legere ocurreret pri, animal tacimates complectitur ad cum. Cu eum inermis inimicus efficiendi. Labore officiis his ex, soluta officiis concludaturque ei qui, vide sensibus vim ad.
+``` + +Lorem ipsum dolor sit amet, graecis denique ei vel, at duo primis mandamus. Et legere ocurreret pri, animal tacimates complectitur ad cum. Cu eum inermis inimicus efficiendi. Labore officiis his ex, soluta officiis concludaturque ei qui, vide sensibus vim ad.
+ +--- + +{{< gist spf13 7896402 >}}