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 {
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;
}

View file

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