Skip to content

Commit 8e775d6

Browse files
committed
chore: update README.md
1 parent 9935903 commit 8e775d6

File tree

1 file changed

+5
-77
lines changed

1 file changed

+5
-77
lines changed

README.md

Lines changed: 5 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,8 @@
11
# Hugo Code Block Panel Module
22

3-
A simple code block panel for Hugo, [preview it online](https://projects.razonyang.com/hugo-mod-code-block-panel/).
3+
[![Used By](https://img.shields.io/badge/dynamic/json?color=success&label=used+by&query=repositories_humanize&logo=hugo&style=flat-square&url=https://api.razonyang.com/v1/github/dependents/hugomods/code-block-panel)](https://github.com/hugomods/code-block-panel/network/dependents)
4+
![Hugo Requirements](https://img.shields.io/badge/dynamic/json?color=important&label=requirements&query=requirements&logo=hugo&style=flat-square&url=https://api.razonyang.com/v1/hugo/modules/github.com/hugomods/code-block-panel)
5+
[![License](https://img.shields.io/github/license/hugomods/code-block-panel?style=flat-square)](https://github.com/hugomods/code-block-panel/blob/main/LICENSE)
6+
[![Version](https://img.shields.io/github/v/tag/hugomods/code-block-panel?label=version&style=flat-square)](https://github.com/hugomods/code-block-panel/tags)
47

5-
## Features
6-
7-
- Expand toggle.
8-
- Copy code.
9-
- Line number toggle.
10-
- Wrap toggle.
11-
12-
## Installation
13-
14-
### 1.Import the Module
15-
16-
```toml
17-
[[module.imports]]
18-
path = "github.com/hugomods/code-block-panel"
19-
```
20-
21-
### 2. Tweak Configuration
22-
23-
The module requires the following configuration to be set as corresponding values.
24-
25-
```toml
26-
[markup.highlight]
27-
lineNos = true
28-
lineNumbersInTable = false
29-
```
30-
31-
### 3. Import CSS
32-
33-
You'll need import two SCSS files first.
34-
35-
```scss
36-
// assets/main.scss
37-
@import "mods/snackbar/scss/index"; // used to show the result of copying code.
38-
@import "mods/code-block-panel/scss/index";
39-
```
40-
41-
> The import paths is relative to the `assets` folder.
42-
43-
And then transform it to CSS in partial.
44-
45-
```go
46-
{{ $css := resources.Get "main.scss" }}
47-
{{ $css = $css | toCSS }}
48-
<link rel="stylesheet" href="{{ $css.RelPermalink }}" />
49-
```
50-
51-
### 4. Import JS
52-
53-
Import JS by using Hugo Pipe.
54-
55-
```go
56-
{{ $js := resources.Get "main.ts" | js.Build }}
57-
{{ $codeJS := partialCached "code-block-panel/assets/js-resource" . }}
58-
{{ $js = slice $js $searchJS | resources.Concat "js/main.js" }}
59-
<script src="{{ $js.RelPermalink }}" defer></script>
60-
```
61-
62-
Or import JS via partial.
63-
64-
```go
65-
{{ partialCached "code-block-panel/assets/js" . }}
66-
```
67-
68-
## Parameters
69-
70-
```toml
71-
[params.code_block_panel]
72-
max_lines = 10
73-
# ...
74-
```
75-
76-
| Name | Type | Default | Description
77-
|---|---|---|---
78-
| `line_nos` | Boolean | `true` | Show/Hide the line numbers by default.
79-
| `max_lines` | Number | `10` | The max visible lines.
80-
| `wrap` | Boolean | `false` | When `true`, wrap the code by default.
8+
A simple code block panel module for Hugo, which includes expand toggle, code copy button, line number toggle and wrap toggle. Please check out the [documentations](https://hugomods.com/en/docs/code-block-panel/) for details.

0 commit comments

Comments
 (0)