From 5acef4c8bcff1e4e47956c265ef6d30345272677 Mon Sep 17 00:00:00 2001 From: Mivinci <1366723936@qq.com> Date: Thu, 9 Dec 2021 09:58:29 +0800 Subject: [PATCH] fix code-highlighting style --- assets/sass/syntax.scss | 30 +++++++++--- exampleSite/content/markdown-syntax.md | 65 ++++++++++++++++++++------ 2 files changed, 75 insertions(+), 20 deletions(-) diff --git a/assets/sass/syntax.scss b/assets/sass/syntax.scss index c080451..a37efa3 100644 --- a/assets/sass/syntax.scss +++ b/assets/sass/syntax.scss @@ -8,7 +8,7 @@ code[class*="language-"] { } pre { - line-height: 1.2; + line-height: 1.5; } .chroma { @@ -38,7 +38,7 @@ pre { .chroma .lnt { color: #999; display: block; - padding-left: .5em; + padding-left: .9em; padding-right: 1em; text-align: right; line-height: 1.5; @@ -51,7 +51,7 @@ pre { .chroma .kn, .chroma .kp, .chroma .kr, -.chroma .kt, +// .chroma .kt, .chroma .k, .chroma .si { color: #569cd6; @@ -61,15 +61,15 @@ pre { color: #9cdcfe; } -.chroma .n, +// .chroma .n, .chroma .nb, .chroma .bp, -.chroma .nc, +// .chroma .nc, .chroma .no, .chroma .nd, .chroma .ni, .chroma .ne, -.chroma .nf, +// .chroma .nf, .chroma .fm, .chroma .nl, .chroma .nn { @@ -100,7 +100,8 @@ pre { .chroma .sx, .chroma .sr, .chroma .s1, -.chroma .ss { +.chroma .ss, +.chroma .cpf { color: #ce9178; } /* LiteralNumber */ @@ -123,3 +124,18 @@ pre { color: #517043; } +.chroma .nb, +.chroma .kt { + color: #4ec9b0; +} + +.chroma .fm, +.chroma .nf { + color: #dcdcaa; +} + + +.chroma .cp { + color: #c586c0; +} + diff --git a/exampleSite/content/markdown-syntax.md b/exampleSite/content/markdown-syntax.md index 54c55f4..8fedb1d 100644 --- a/exampleSite/content/markdown-syntax.md +++ b/exampleSite/content/markdown-syntax.md @@ -94,21 +94,60 @@ Tables aren't part of the core Markdown spec, but Hugo supports supports them ou -#### Code block with Hugo's internal highlight shortcode +#### Code block with Golang -{{< highlight html >}} - +```go +type Registry interface { + Register(*Service, ...RegisterOption) error + Deregister(*Service, ...DeregisterOption) error + GetService(string, ...GetOption) ([]*Service, error) +} +``` - - - - Example HTML5 Document - - -

Test

- - -{{< /highlight >}} +#### Code block with C艹 + +```c++ +#include + +class Animal { + string name; +public: + void eat(); +} + +void Animal::eat() { + std::cout << "eat something" << std::endl; +} +``` + +#### Code block with Java + +```java +class Animal { + void speak() { /* speak */ } +} + +class Dog extends Animal { + @override + void speak() { /* bark */ } +} + +class Cat extends Animal { + @override + void speak() { /* mew */ } +} +``` + +#### Code block with Python + +```python +class Dog(Animal): + def __init__(self): + super.__init__() + + def eat(): + pass +``` ## List Types