Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion static/css/hugo-theme.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
/* Insert here special css for hugo theme, on top of any other imported css */

/* Language display style borrowed from scotch.io. Thanks! */
pre {
border-radius: 10px;
border: none;
position: relative;
padding: 50px 40px 30px;
z-index: 1;
}

pre:after {
border-top-left-radius: 5px;
border-top-right-radius: 5px;
content: "";
display: block;
position: absolute;
top: 0;
left: 0;
right: 0;
height: 8px;
background: #ddd;
}

pre:before {
content: attr(data-title);
position: absolute;
top: 7px;
padding: 0 10px 3px;
font-size: 10px;
text-align: right;
color: #444;
font-weight: 700;
letter-spacing: .8px;
text-transform: uppercase;
border-radius: 0 0 5px 5px;
background: #ddd;
}

/* Table of contents */

Expand Down Expand Up @@ -250,5 +286,5 @@ figcaption h4 {
}

.is-sticky #top-bar {
box-shadow: -1px 2px 5px 1px rgba(0, 0, 0, 0.1);
box-shadow: -1px 2px 5px 1px rgba(0, 0, 0, 0.1);
}
4 changes: 2 additions & 2 deletions static/css/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -1077,8 +1077,8 @@ td {
pre .copy-to-clipboard {
position: absolute;
right: 4px;
top: 4px;
background-color: #949bab;
top:10px;
background-color: #ddd;
color: #ccc;
border-radius: 2px;
}
Expand Down
17 changes: 17 additions & 0 deletions static/js/learn.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
// Add a language label per each code block
$("pre").each(function (i, e) {
// Intialize with empty value
$(e).attr("data-title", " ");
});

$("pre code").each(function (i, e) {
var code = $(e);
var pre = code.parent();

var html_class = code.attr('class')
var language = html_class ? html_class.replace('language-', '') : "text";
var text_block = pre.text();

pre.attr("data-title", language);
});

// Scrollbar Width function
function getScrollBarWidth() {
var inner = document.createElement('p');
Expand Down