Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to Octopress code highlighter #1590

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
.sass-cache
.gist-cache
.pygments-cache
.code-highlighter-cache
Gemfile.lock
_deploy
public
sass.old
Expand Down
2 changes: 1 addition & 1 deletion .themes/classic/sass/_base.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import "base/utilities";
@import "base/solarized";
@import "base/solarized/index";
@import "base/theme";
@import "base/typography";
@import "base/layout";
1 change: 0 additions & 1 deletion .themes/classic/sass/_partials.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
@import "partials/navigation";
@import "partials/blog";
@import "partials/sharing";
@import "partials/syntax";
@import "partials/archive";
@import "partials/sidebar";
@import "partials/footer";
46 changes: 0 additions & 46 deletions .themes/classic/sass/base/_solarized.scss

This file was deleted.

175 changes: 175 additions & 0 deletions .themes/classic/sass/base/solarized/_code-highlight.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
@include solarized-theme($solarized);

// Inilne <code> element styles
//
code,
kbd,
samp,
tt {
color: inherit;
background-color: $code-bg;
border: 1px solid $code-border;
font-family: $code-font-family;
border-radius: 3px;
font-size: $code-font-size;
&:before, &:after {
content: "\00a0";
letter-spacing: -0.2em;
}
}

// Overide <code> styles beneath <pre>
//
pre code {
&:before, &:after {
content: none;
}
border: none;
background: none;
border-raidus: 0;
font-size: inherit;
}

// Basic pre styles
//
pre, pre code {
* { box-sizing: border-box; }
font-size: $pre-font-size;
font-family: $pre-font-family;
}

// Styles for pre's which aren't highlighted by Octopress's highlighter
//
.highlight pre,
pre:not(.code-highlight-pre),
.code-highlight {
span { font-style: normal; font-weight: normal; }

overflow: scroll;
overflow-y: hidden;
overflow-x: auto;
line-height: 1.45em;
}


// Styles for Octopress highlighted code blocks.
//
.code-highlight-figure {
margin: 1.8em 0;
font-size: 14px;
* { box-sizing: border-box; }
background: none;
padding: 0;
border: 0;

pre { margin: { top: 0; bottom: 0; } }

}

.code-highlight-caption {
position: relative;
text-align: center;
line-height: 2em;
text-shadow: rgba(#fff, .8) 0 1px 0;
color: #474747;
font-weight: normal;
margin-bottom: 0;
background-color: #ccc;
@include background(linear-gradient(#ffffff, #f0f0f0 6%, #e5e5e5 90%, #e5e5e5));
border-top-left-radius: 5px;
border-top-right-radius: 5px;
font-family: "Helvetica Neue", Arial, "Lucida Grande", "Lucida Sans Unicode", Lucida, sans-serif;
border: 1px solid #cbcbcb;
+ .code-highlight { border-top: 0; }
}

.code-highlight-caption-link {
position: absolute; right: .8em;
color: #666;
z-index: 1;
text-shadow: rgba(#fff, .8) 0 1px 0;
padding-left: 3em;
}

.highlight pre,
pre:not(.code-highlight-pre) {
padding: 1em .8rem;
border-radius: .4em;
margin: 1.8em 0;
}

.code-highlight-pre {
width: 100%;
margin-bottom: 0;
display: table;
}

.code-highlight-row {
display: table-row;
width: 100%;

&:before, .code-highlight-line {
padding: {left: $pre-line-padding + .8; right: $pre-line-padding + .8 }
}

&:first-child {
&:before, .code-highlight-line { padding-top: $pre-line-padding; }
}

&:last-child {
&:before, .code-highlight-line { padding-bottom: $pre-line-padding; }
}

&.numbered {

&:before, .code-highlight-line {
padding: {left: $pre-line-padding; right: $pre-line-padding }
}

&:before {
display: table-cell;
content: attr(data-line);
min-width: 1.2em;
text-align: right;
line-height: 1.45em;
}
}
}

.code-highlight-line {
display: table-cell;
width: 100%;
position: relative;
z-index: 1;
}


.marked-line {
position: relative;
.code-highlight-line {
&:before {
content: "";
position: absolute;
left: 0; top: 0; bottom: 0; right: 0;
border-right: 1px solid $pre-marker-border;
}
}
&.unnumbered .code-highlight-line:before {
border-left: 3px solid $pre-marker-border-left;
}
&.numbered:before {
border-left: 3px solid $pre-marker-border-left;
}
}

.start-marked-line {
&:before, .code-highlight-line:before {
border-top: 1px solid $pre-marker-border;
}
}

.end-marked-line {
&:before, .code-highlight-line:before {
border-bottom: 1px solid $pre-marker-border;
}
}
Loading