fix code-highlighting style

This commit is contained in:
Mivinci 2021-12-09 09:58:29 +08:00
parent 40765ae342
commit 5acef4c8bc
2 changed files with 75 additions and 20 deletions

View file

@ -8,7 +8,7 @@ code[class*="language-"] {
} }
pre { pre {
line-height: 1.2; line-height: 1.5;
} }
.chroma { .chroma {
@ -38,7 +38,7 @@ pre {
.chroma .lnt { .chroma .lnt {
color: #999; color: #999;
display: block; display: block;
padding-left: .5em; padding-left: .9em;
padding-right: 1em; padding-right: 1em;
text-align: right; text-align: right;
line-height: 1.5; line-height: 1.5;
@ -51,7 +51,7 @@ pre {
.chroma .kn, .chroma .kn,
.chroma .kp, .chroma .kp,
.chroma .kr, .chroma .kr,
.chroma .kt, // .chroma .kt,
.chroma .k, .chroma .k,
.chroma .si { .chroma .si {
color: #569cd6; color: #569cd6;
@ -61,15 +61,15 @@ pre {
color: #9cdcfe; color: #9cdcfe;
} }
.chroma .n, // .chroma .n,
.chroma .nb, .chroma .nb,
.chroma .bp, .chroma .bp,
.chroma .nc, // .chroma .nc,
.chroma .no, .chroma .no,
.chroma .nd, .chroma .nd,
.chroma .ni, .chroma .ni,
.chroma .ne, .chroma .ne,
.chroma .nf, // .chroma .nf,
.chroma .fm, .chroma .fm,
.chroma .nl, .chroma .nl,
.chroma .nn { .chroma .nn {
@ -100,7 +100,8 @@ pre {
.chroma .sx, .chroma .sx,
.chroma .sr, .chroma .sr,
.chroma .s1, .chroma .s1,
.chroma .ss { .chroma .ss,
.chroma .cpf {
color: #ce9178; color: #ce9178;
} }
/* LiteralNumber */ /* LiteralNumber */
@ -123,3 +124,18 @@ pre {
color: #517043; color: #517043;
} }
.chroma .nb,
.chroma .kt {
color: #4ec9b0;
}
.chroma .fm,
.chroma .nf {
color: #dcdcaa;
}
.chroma .cp {
color: #c586c0;
}

View file

@ -94,21 +94,60 @@ Tables aren't part of the core Markdown spec, but Hugo supports supports them ou
</body> </body>
</html> </html>
#### Code block with Hugo's internal highlight shortcode #### Code block with Golang
{{< highlight html >}} ```go
<!doctype html> type Registry interface {
Register(*Service, ...RegisterOption) error
Deregister(*Service, ...DeregisterOption) error
GetService(string, ...GetOption) ([]*Service, error)
}
```
<html lang="en"> #### Code block with C艹
<head>
<meta charset="utf-8"> ```c++
<title>Example HTML5 Document</title> #include <iostream>
</head>
<body> class Animal {
<p>Test</p> string name;
</body> public:
</html> void eat();
{{< /highlight >}} }
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 ## List Types