Skip to content

Commit 16cf787

Browse files
committed
💄 add light theme
1 parent 5de3fa7 commit 16cf787

File tree

7 files changed

+66
-36
lines changed

7 files changed

+66
-36
lines changed

README.md

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,43 @@
11

22
<div align="center">
33
<h1> Terminull </h1>
4-
<p>Terminull is a <a href="https://www.npmjs.com/package/gitbook">gitbook</a> plugin allows you to create a modern terminal for your gitbook pages in order to documente your commands and it gives you a fast way to copy the command .</p>
5-
<br>
6-
<br>
7-
<a href="https://www.npmjs.com/package/gitbook-plugin-terminull"><img src="https://img.shields.io/npm/v/gitbook-plugin-terminull/latest?color=green" alt="npm version"></a>
8-
<br>
9-
<br>
10-
<img src="https://raw.githubusercontent.com/ridaeh/gitbook-plugin-terminull/master/preview.png">
4+
<p>Terminull is a <a href="https://www.npmjs.com/package/gitbook">gitbook</a> plugin allows you to create a modern terminal for your gitbook pages it helps documente your commands and gives you a fast way to copy the command .</p>
5+
</div>
6+
<a href="https://www.npmjs.com/package/gitbook-plugin-terminull"><img src="https://img.shields.io/npm/v/gitbook-plugin-terminull/latest?color=green" alt="npm version"/></a>
7+
8+
## Themes:
9+
### Dark theme
10+
11+
<div align="center">
12+
<img src="https://raw.githubusercontent.com/ridaeh/gitbook-plugin-terminull/master/dark_theme_preview.png"/>
13+
</div>
14+
15+
### Light theme
16+
<div align="center">
17+
<img src="https://raw.githubusercontent.com/ridaeh/gitbook-plugin-terminull/master/light_theme_preview.png"/>
1118
</div>
1219

1320
## How to use it?
1421
To use Terminull plugin in your Gitbook project, add the terminull plugin to the `book.json` file of your project, then install plugins using `gitbook install`.
1522

1623
```json
1724
{
18-
"plugins": ["terminull"]
25+
"plugins": ["terminull"],
26+
"pluginsConfig": {
27+
"terminull": {
28+
"theme": "dark", // use "light" for light theme
29+
"copy_button": "enabled" // "disabled" to hide the copy button
30+
}
31+
}
1932
}
2033
```
2134

2235
## Create you terminal
2336

24-
To create a terminal you can use one of this options:
37+
To create a terminal you can use one of two options:
2538
- Code markdown with `term` as language :
2639
<pre ><code>```<strong style="color:green">term</strong>
27-
gitbook-plugin-terminull$ echo 'hello terminull' # This will print hello terminull
40+
terminull$ echo 'hello terminull' # This will print hello terminull
2841
hello terminull
2942
```
3043
</code></pre>
@@ -34,6 +47,7 @@ e.g :
3447
echo 'hello terminull'
3548
```
3649
</code></pre>
50+
3751
- Gitbook term tag
3852

3953
Each terminal should have a directory where command is excuted, command and output of the command.

assets/terminull.css

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,36 @@
1+
:root {
2+
--terminull-background-color: #282d39;
3+
--terminull-color: white;
4+
}
5+
6+
[data-theme="light"] {
7+
--terminull-background-color:#fdf6e4;
8+
--terminull-color: #282d39;
9+
}
10+
111
.terminull {
2-
background-color: #282d39;
12+
background-color: var(--terminull-background-color);
313
border-radius: 5px;
14+
font-family: "Ubuntu Mono", Consolas, Menlo, Courier, monospace;
15+
font-size: 1em;
416
}
517

618
.terminullMenu {
719
box-sizing: border-box;
8-
height: 25px;
20+
height: 20px;
921
margin: 0 auto;
22+
padding-left: 10px;
1023
border-top-right-radius: 5px;
1124
border-top-left-radius: 5px;
1225
}
1326

1427
.terminullScreen {
1528
box-sizing: border-box;
1629
margin: 0 auto;
17-
padding: 20px;
30+
padding: 10px;
1831
border-bottom-left-radius: 5px;
1932
border-bottom-right-radius: 5px;
20-
color: white;
33+
color: var(--terminull-color);
2134
text-align: left;
2235
font-family: monospace;
2336
white-space: nowrap;
@@ -30,13 +43,13 @@
3043
}
3144

3245
.terminullButtons {
33-
height: 10px;
34-
width: 10px;
46+
height: 8px;
47+
width: 8px;
3548
border-radius: 50%;
3649
border: 1px solid #000;
3750
position: relative;
38-
top: 6px;
39-
left: 6px;
51+
top: 5px;
52+
left: 5px;
4053
background-color: #ff3b47;
4154
border-color: #9d252b;
4255
display: inline-block;

dark_theme_preview.png

9.49 KB
Loading

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const kramed = require('./src/kramed');
55
function processBlock(rootBlock) {
66
var terminulls = [];
77
var term = {};
8+
var options = this.options.pluginsConfig["terminull"];
89
rootBlock.blocks.forEach(_blk => {
910
if (term[_blk.name]) {
1011
terminulls.push(term);
@@ -16,7 +17,7 @@ function processBlock(rootBlock) {
1617
return new Promise(function(resolve, reject) {
1718
ejs.renderFile(
1819
path.join(__dirname, './src/terminull.html.ejs'),
19-
{ terminulls: terminulls },
20+
{ terminulls: terminulls ,options: options },
2021
function(err, str) {
2122
if (err) {
2223
throw err;

light_theme_preview.png

9.72 KB
Loading

preview.png

-19.6 KB
Binary file not shown.

src/terminull.html.ejs

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
<div class="terminull">
2-
<div class="terminullMenu">
3-
<div class="terminullButtons terminullClose"></div>
4-
<div class="terminullButtons terminullMinimize"></div>
5-
<div class="terminullButtons terminullZoom"></div>
6-
</div>
7-
<div class="terminullScreen">
8-
<% terminulls.forEach(function(terminull){ %>
9-
<span class="terminullDirectory">~/<%= terminull.directory %></span>$
10-
<span class="terminullCommand"><%= terminull.command%></span>
11-
<% if (terminull.comment) { %>
12-
<span class="terminullComment"># <%= terminull.comment%></span>
13-
<% } %>
14-
<i class="fa fa-clone t-copy terminullCopyBtn" onclick="copyCommandTerminull(`<%= terminull.command%>`)"></i>
15-
<span class="terminullOutput"><%= terminull.output%></span>
16-
<% }); %>
17-
</div>
1+
<div class="terminull" data-theme="<%= options.theme %>" >
2+
<div class="terminullMenu">
3+
<div class="terminullButtons terminullClose"></div>
4+
<div class="terminullButtons terminullMinimize"></div>
5+
<div class="terminullButtons terminullZoom"></div>
6+
</div>
7+
<div class="terminullScreen">
8+
<% terminulls.forEach(function(terminull){ %>
9+
<span class="terminullDirectory">~/<%= terminull.directory %></span>$
10+
<span class="terminullCommand"><%= terminull.command%></span>
11+
<% if (terminull.comment) { %>
12+
<span class="terminullComment"># <%= terminull.comment%></span>
13+
<% } %>
14+
<% if(options.copy_button && options.copy_button !== 'disabled'){ %>
15+
<i class="fa fa-clone t-copy terminullCopyBtn" onclick="copyCommandTerminull(`<%= terminull.command%>`)"></i>
16+
<% } %>
17+
<span class="terminullOutput"><%= terminull.output%></span>
18+
<% }); %>
19+
</div>
1820
</div>

0 commit comments

Comments
 (0)