Permalink
Browse files

Syntax highlighting now works

  • Loading branch information...
1 parent 2e75b9e commit 32e32b664957ff14c89c61417fc254b7c6eaad85 @craveytrain committed Oct 7, 2013
View
49 content/posts/temp.md
@@ -7,7 +7,8 @@ date: 2013-10-01
# This is a test
This is a test.
-```html
+# HTML
+``` html
<h1>This is code</h1>
<script>
var i = 0;
@@ -16,3 +17,49 @@ function() {
}
</script>
```
+``` js
+var stuff = {
+ holas: 'whatup'
+};
+```
+
+# Ruby
+``` ruby
+class A < B; def self.create(object = User) object end end
+class Zebra; def inspect; "X#{2 + self.object_id}" end end
+
+module ABC::DEF
+ include Comparable
+
+ # @param test
+ # @return [String] nothing
+ def foo(test)
+ Thread.new do |blockvar|
+ ABC::DEF.reverse(:a_symbol, :'a symbol', :<=>, 'test' + test)
+ end.join
+ end
+
+ def [](index) self[index] end
+ def ==(other) other == self end
+end
+
+anIdentifier = an_identifier
+Constant = 1
+render action: :new
+```
+
+# Python
+``` python
+@requires_authorization
+def somefunc(param1='', param2=0):
+ r'''A docstring'''
+ if param1 > param2: # interesting
+ print 'Gre\'ater'
+ return (param2 - param1 + 1) or None
+
+class SomeClass:
+ pass
+
+>>> message = '''interpreter
+... prompt'''
+```
View
11 models/post.js
@@ -1,15 +1,12 @@
'use strict';
-var marked = require('marked');
+var marked = require('supermarked');
var excerpt = require('../lib/excerpt');
var extend = require('extend');
-marked.setOptions({
- gfm: true,
- pedantic: false,
- sanitize: true
-});
-
+marked.aliases = {
+ html: 'xml'
+};
module.exports = function(baseModel, data) {
var content = data.__content.trim();
View
4 package.json
@@ -21,7 +21,6 @@
"dependencies": {
"extend": "~1.2.1",
"js-yaml": "~2.1.0",
- "marked": "~0.2.9",
"grunt": "~0.4.1",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-jade": "~0.8.0",
@@ -33,7 +32,8 @@
"grunt-contrib-connect": "~0.5.0",
"grunt-contrib-htmlmin": "~0.1.3",
"grunt-contrib-stylus": "~0.8.0",
- "yaml-front-matter": "~2.1.0"
+ "yaml-front-matter": "~2.1.0",
+ "supermarked": "~1.1.0"
},
"devDependencies": {
"highlight": "~0.2.3"
View
4 source/stylesheets/default.styl
@@ -2,14 +2,14 @@
@import 'vars/fonts'
@import 'vars/icons'
@import 'vars/layout'
-@import 'vars/solarized'
@import 'utils/selection'
@import 'html5bp/normalize'
@import 'includes/craveytrain'
-@import 'includes/syntax'
+
+@import 'highlight.js/syntax'
@import 'html5bp/helpers'
@import 'html5bp/print'
View
91 source/stylesheets/highlight.js/syntax.styl
@@ -0,0 +1,91 @@
+/*
+
+Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull <sourdrums@gmail.com>
+
+*/
+
+pre code {
+ display: block; padding: 0.5em;
+ background: #002b36; color: #839496;
+}
+
+pre .comment,
+pre .template_comment,
+pre .diff .header,
+pre .doctype,
+pre .pi,
+pre .lisp .string,
+pre .javadoc {
+ color: #586e75;
+ font-style: italic;
+}
+
+pre .keyword,
+pre .winutils,
+pre .method,
+pre .addition,
+pre .css .tag,
+pre .request,
+pre .status,
+pre .nginx .title {
+ color: #859900;
+}
+
+pre .number,
+pre .command,
+pre .string,
+pre .tag .value,
+pre .rules .value,
+pre .phpdoc,
+pre .tex .formula,
+pre .regexp,
+pre .hexcolor {
+ color: #2aa198;
+}
+
+pre .title,
+pre .localvars,
+pre .chunk,
+pre .decorator,
+pre .built_in,
+pre .identifier,
+pre .vhdl .literal,
+pre .id,
+pre .css .function {
+ color: #268bd2;
+}
+
+pre .attribute,
+pre .variable,
+pre .lisp .body,
+pre .smalltalk .number,
+pre .constant,
+pre .class .title,
+pre .parent,
+pre .haskell .type {
+ color: #b58900;
+}
+
+pre .preprocessor,
+pre .preprocessor .keyword,
+pre .shebang,
+pre .symbol,
+pre .symbol .string,
+pre .diff .change,
+pre .special,
+pre .attr_selector,
+pre .important,
+pre .subst,
+pre .cdata,
+pre .clojure .title,
+pre .css .pseudo {
+ color: #cb4b16;
+}
+
+pre .deletion {
+ color: #dc322f;
+}
+
+pre .tex .formula {
+ background: #073642;
+}
View
278 source/stylesheets/includes/syntax.styl
@@ -1,278 +0,0 @@
-.highlight, html .gist .gist-file .gist-syntax .gist-highlight {
- table td.code { width: 100%; }
-
- .line-numbers {
- text-align: right;
- font-size: 13px;
- line-height: 1.45em;
- background: $base02 !important;
- border-right: 1px solid darken($base03, 2) !important;
- box-shadow(lighten($base02, 2) -1px 0 inset);
- text-shadow: darken($base02, 10) 0 -1px;
- padding: .8em !important;
- border-radius: 0;
-
- span {
- color: $base01 !important;
- }
- }
- border: 1px solid $pre-border !important;
-}
-
-.pre-code {
- selection(adjust-color($base03, $lightness = 23%, $saturation = -65%), $text-shadow = $base03 0 1px);
- font-family: $mono !important;
- overflow: scroll;
- overflow-y: hidden;
- display: block;
- padding: .8em !important;
- overflow-x: auto;
- line-height: 1.45em;
- background: $base03 !important;
- color: $base1 !important;
- span { color: $base1 !important; }
- span { font-style: normal !important; font-weight: normal !important; }
-
- .c { color: $base01 !important; font-style: italic !important; } /* Comment */
- .cm { color: $base01 !important; font-style: italic !important; } /* Comment.Multiline */
- .cp { color: $base01 !important; font-style: italic !important; } /* Comment.Preproc */
- .c1 { color: $base01 !important; font-style: italic !important; } /* Comment.Single */
- .cs { color: $base01 !important; font-weight: bold !important; font-style: italic !important; } /* Comment.Special */
- .err { color: $solar-red !important; background: none !important; } /* Error */
- .k { color: $solar-orange !important; } /* Keyword */
- .o { color: $base1 !important; font-weight: bold !important; } /* Operator */
- .p { color: $base1 !important; } /* Operator */
- .ow { color: $solar-cyan !important; font-weight: bold !important; } /* Operator.Word */
- .gd { color: $base1 !important; background-color: mix($solar-red, $base03, 25%) !important; display: inline-block; } /* Generic.Deleted */
- .gd .x { color: $base1 !important; background-color: mix($solar-red, $base03, 35%) !important; display: inline-block; } /* Generic.Deleted.Specific */
- .ge { color: $base1 !important; font-style: italic !important; } /* Generic.Emph */
- //.gr { color: #aa0000 } /* Generic.Error */
- .gh { color: $base01 !important; } /* Generic.Heading */
- .gi { color: $base1 !important; background-color: mix($solar-green, $base03, 20%) !important; display: inline-block; } /* Generic.Inserted */
- .gi .x { color: $base1 !important; background-color: mix($solar-green, $base03, 40%) !important; display: inline-block; } /* Generic.Inserted.Specific */
- //.go { color: #888888 } /* Generic.Output */
- //.gp { color: #555555 } /* Generic.Prompt */
- .gs { color: $base1 !important; font-weight: bold !important; } /* Generic.Strong */
- .gu { color: $solar-violet !important; } /* Generic.Subheading */
- //.gt { color: #aa0000 } /* Generic.Traceback */
- .kc { color: $solar-green !important; font-weight: bold !important; } /* Keyword.Constant */
- .kd { color: $solar-blue !important; } /* Keyword.Declaration */
- .kp { color: $solar-orange !important; font-weight: bold !important; } /* Keyword.Pseudo */
- .kr { color: $solar-magenta !important; font-weight: bold !important; } /* Keyword.Reserved */
- .kt { color: $solar-cyan !important; } /* Keyword.Type */
- .n { color: $solar-blue !important; }
- .na { color: $solar-blue !important; } /* Name.Attribute */
- .nb { color: $solar-green !important; } /* Name.Builtin */
- .nc { color: $solar-magenta !important;} /* Name.Class */
- .no { color: $solar-yellow !important; } /* Name.Constant */
- //.ni { color: #800080 } /* Name.Entity */
- .nl { color: $solar-green !important; }
- .ne { color: $solar-blue !important; font-weight: bold !important; } /* Name.Exception */
- .nf { color: $solar-blue !important; font-weight: bold !important; } /* Name.Function */
- .nn { color: $solar-yellow !important; } /* Name.Namespace */
- .nt { color: $solar-blue !important; font-weight: bold !important; } /* Name.Tag */
- .nx { color: $solar-yellow !Important; }
- //.bp { color: #999999 } /* Name.Builtin.Pseudo */
- //.vc { color: #008080 } /* Name.Variable.Class */
- .vg { color: $solar-blue !important; } /* Name.Variable.Global */
- .vi { color: $solar-blue !important; } /* Name.Variable.Instance */
- .nv { color: $solar-blue !important; } /* Name.Variable */
- //.w { color: #bbbbbb } /* Text.Whitespace */
- .mf { color: $solar-cyan !important; } /* Literal.Number.Float */
- .m { color: $solar-cyan !important; } /* Literal.Number */
- .mh { color: $solar-cyan !important; } /* Literal.Number.Hex */
- .mi { color: $solar-cyan !important; } /* Literal.Number.Integer */
- //.mo { color: #009999 } /* Literal.Number.Oct */
- .s { color: $solar-cyan !important; } /* Literal.String */
- //.sb { color: #d14 } /* Literal.String.Backtick */
- //.sc { color: #d14 } /* Literal.String.Char */
- .sd { color: $solar-cyan !important; } /* Literal.String.Doc */
- .s2 { color: $solar-cyan !important; } /* Literal.String.Double */
- .se { color: $solar-red !important; } /* Literal.String.Escape */
- //.sh { color: #d14 } /* Literal.String.Heredoc */
- .si { color: $solar-blue !important; } /* Literal.String.Interpol */
- //.sx { color: #d14 } /* Literal.String.Other */
- .sr { color: $solar-cyan !important; } /* Literal.String.Regex */
- .s1 { color: $solar-cyan !important; } /* Literal.String.Single */
- //.ss { color: #990073 } /* Literal.String.Symbol */
- //.il { color: #009999 } /* Literal.Number.Integer.Long */
- div {
- .gd, .gd .x, .gi, .gi .x {
- display: inline-block; width: 100%;
- }
- }
-}
-
-.code-title {
- text-align: center;
- font-size: 13px;
- line-height: 2em;
- text-shadow: #cbcccc 0 1px 0;
- color: #474747;
- font-weight: normal;
- margin-bottom: 0;
- border-top-radius: 5px;
- font-family: $sans;
- background-color: #aaa;
- background-image: linear-gradient(top,
- #e0e0e0,
- #cecece 8%,
- #bbbbbb 48%,
- #b7b7b7 52%,
- #ababab 76%,
- #a8a8a8 84%,
- #a8a8a8 96%,
- #aaaaaa);
- border: 1px solid #565656;
- border-top-color: #cbcbcb;
- border-left-color: #a5a5a5;
- border-right-color: #a5a5a5;
- border-bottom: 0;
-}
-
-.download-source {
- position: absolute; right: .8em;
- // @include hover-link;
- color: #666 !important;
- z-index: 1;
- font-size: 13px;
- text-shadow: #cbcccc 0 1px 0;
- padding-left: 3em;
-}
-
-
-figure.code, .gist-file, pre {
- box-shadow: rgba(#000, .06) 0 0 10px;
- .highlight pre {
- box-shadow: none;
- }
-}
-
-html .gist .gist-file {
- margin-bottom: 1.8em;
- position: relative;
- border: none;
- padding-top: 26px !important;
- .gist-syntax {
- border-bottom: 0 !important;
- background: none !important;
- .gist-highlight{
- background: $base03 !important;
- pre {
- @extend .pre-code;
- }
- }
- }
- .gist-meta {
- padding: .6em 0.8em;
- border: 1px solid lighten($base02, 2) !important;
- color: $base01;
- font-size: .7em !important;
- background: $base02;
- font-family: $sans;
- line-height: 1.5em;
- a {
- color: mix($base1, $base01) !important;
- @include hover-link;
- &:hover { color: $base1 !important; }
- }
- a[href*='#file'] {
- position: absolute; top: 0; left:0; right:-10px;
- color: #474747 !important;
- @extend .code-title;
-
- &:hover {
- color: $link-color !important;
- }
- }
- a[href*=raw]{
- @extend .download-source;
- top: .4em;
- }
- }
-}
-pre {
- background: $pre-bg;
- @include border-radius(.4em);
- font-family: $mono;
- border: 1px solid $pre-border;
- line-height: 1.45em;
- font-size: 13px;
- margin-bottom: 2.1em;
- padding: .8em 1em;
- color: $pre-color;
- overflow: auto;
-}
-h3.filename {
- @extend .code-title;
- + pre {
- @include border-top-radius(0px);
- }
-}
-
-p, li {
- code {
- font-family: $mono;
- display: inline-block;
- white-space: no-wrap;
- background: #fff;
- font-size: .8em;
- line-height: 1.5em;
- color: #555;
- border: 1px solid #ddd;
- @include border-radius(.4em);
- padding: 0 .3em;
- margin: -1px 0;
- }
- pre code { font-size: 1em !important; background: none; border: none; }
-}
-
-
-
-.highlight, .gist-highlight {
- pre {
- background: none;
- border-radius: none;
- border: none;
- padding: 0;
- margin-bottom: 0;
- }
- margin-bottom: 1.8em;
- background: $base03;
- overflow-y: hidden;
- overflow-x: auto;
-}
-
-$solar-scroll-bg = rgba(#fff, .15);
-$solar-scroll-thumb = rgba(#fff, .2);
-
-pre, .highlight, .gist-highlight {
- &::-webkit-scrollbar { height: .5em; background: $solar-scroll-bg; }
- &::-webkit-scrollbar-thumb:horizontal { background: $solar-scroll-thumb; -webkit-border-radius: 4px; border-radius: 4px }
-}
-
-.highlight code {
- @extend .pre-code;
- background: #000;
-}
-
-figure.code {
- background: none;
- padding: 0;
- border: 0;
- margin-bottom: 1.5em;
- pre { margin-bottom: 0; }
- figcaption {
- position: relative;
- @extend .code-title;
-
- a {
- @extend .download-source;
- }
- }
- .highlight {
- margin-bottom: 0;
- }
-}
-
-
View
23 source/stylesheets/vars/solarized.styl
@@ -1,23 +0,0 @@
-$base03 = #002b36; //darkest blue
-$base02 = #073642; //dark blue
-$base01 = #586e75; //darkest gray
-$base00 = #657b83; //dark gray
-$base0 = #839496; //medium gray
-$base1 = #93a1a1; //medium light gray
-$base2 = #eee8d5; //cream
-$base3 = #fdf6e3; //white
-$solar-yellow = #b58900;
-$solar-orange = #cb4b16;
-$solar-red = #dc322f;
-$solar-magenta = #d33682;
-$solar-violet = #6c71c4;
-$solar-blue = #268bd2;
-$solar-cyan = #2aa198;
-$solar-green = #859900;
-
-/* non highlighted code colors */
-$pre-bg = $base03;
-$pre-border = darken($base02, 5);
-$pre-color = $base1;
-
-

0 comments on commit 32e32b6

Please sign in to comment.