Permalink
Browse files

code hughlighting

  • Loading branch information...
pgte committed Apr 13, 2012
1 parent d2b8e68 commit ec959d1d67e0e81a46c8a66eac1de9c33604cfe2
Showing with 148 additions and 8 deletions.
  1. +1 −0 package.json
  2. +1 −0 public/assets/layout.html
  3. +139 −0 public/css/github-highlight.css
  4. +3 −3 public/css/index.css
  5. +1 −3 server/assets.js
  6. +3 −2 server/content.js
View
@@ -28,6 +28,7 @@
"request": "*",
"plates": "*",
"github-flavored-markdown": "*",
+ "highlight": "*",
"tar": "*",
"underscore": "*"
},
@@ -3,6 +3,7 @@
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="/css/index.css" />
+ <link rel="stylesheet" type="text/css" href="/css/github-highlight.css" />
</head>
<body>
<header>
@@ -0,0 +1,139 @@
+/*
+
+github.com style (c) Vasily Polovnyov <vast@whiteants.net>
+
+*/
+
+pre code {
+ display: block; padding: 1em;
+ line-height: 1.5em;
+ color: #000;
+ background: #f8f8ff;
+ border-radius: 0.25em;
+ -moz-border-radius: 0.25em;
+ -0-border-radius: 0.25em;
+ -webkit-border-radius: 0.25em;
+ box-shadow: inset 0 0.1em 0.2em rgba(0,0,0, 0.3);
+ -moz-box-shadow: inset 0 0.1em 0.2em rgba(0,0,0, 0.3);
+ -o-box-shadow: inset 0 0.1em 0.2em rgba(0,0,0, 0.3);
+ -webkit-box-shadow: inset 0 0.1em 0.2em rgba(0,0,0, 0.3);
+ margin-bottom: 1.5em;
+}
+
+pre .comment,
+pre .template_comment,
+pre .diff .header,
+pre .javadoc {
+ color: #998;
+ font-style: italic
+}
+
+pre .keyword,
+pre .css .rule .keyword,
+pre .winutils,
+pre .javascript .title,
+pre .lisp .title,
+pre .subst {
+ color: #000;
+ font-weight: bold
+}
+
+pre .number,
+pre .hexcolor {
+ color: #40a070
+}
+
+pre .string,
+pre .tag .value,
+pre .phpdoc,
+pre .tex .formula {
+ color: #d14
+}
+
+pre .title,
+pre .id {
+ color: #900;
+ font-weight: bold
+}
+
+pre .javascript .title,
+pre .lisp .title,
+pre .subst {
+ font-weight: normal
+}
+
+pre .class .title,
+pre .haskell .label,
+pre .tex .command {
+ color: #458;
+ font-weight: bold
+}
+
+pre .tag,
+pre .tag .title,
+pre .rules .property,
+pre .django .tag .keyword {
+ color: #000080;
+ font-weight: normal
+}
+
+pre .attribute,
+pre .variable,
+pre .instancevar,
+pre .lisp .body {
+ color: #008080
+}
+
+pre .regexp {
+ color: #009926
+}
+
+pre .class {
+ color: #458;
+ font-weight: bold
+}
+
+pre .symbol,
+pre .ruby .symbol .string,
+pre .ruby .symbol .keyword,
+pre .ruby .symbol .keymethods,
+pre .lisp .keyword,
+pre .tex .special,
+pre .input_number {
+ color: #990073
+}
+
+pre .builtin,
+pre .built_in,
+pre .lisp .title {
+ color: #0086b3
+}
+
+pre .preprocessor,
+pre .pi,
+pre .doctype,
+pre .shebang,
+pre .cdata {
+ color: #999;
+ font-weight: bold
+}
+
+pre .deletion {
+ background: #fdd
+}
+
+pre .addition {
+ background: #dfd
+}
+
+pre .diff .change {
+ background: #0086b3
+}
+
+pre .chunk {
+ color: #aaa
+}
+
+pre .tex .formula {
+ opacity: 0.5;
+}
View
@@ -670,7 +670,7 @@ code {
color: rgba(0, 0, 0, 0.75);
padding: 1px 3px;
}
-pre {
+/*pre {
background-color: #f5f5f5;
display: block;
padding: 8.5px;
@@ -686,7 +686,7 @@ pre {
white-space: pre-wrap;
word-wrap: break-word;
}
-/* Forms.less
+*//* Forms.less
* Base styles for various input types, form layouts, and states
* ------------------------------------------------------------- */
form {
@@ -3256,7 +3256,7 @@ body {
list-style-type: none;
}
#articleCategoryList {
- font-size: 125%;
+˙ font-size: 125%;
color: #659134;
}
View
@@ -1,6 +1,5 @@
var fs = require('fs'),
Plates = require('plates'),
- marked = require('github-flavored-markdown').parse,
assets = module.exports,
_ = require('underscore'),
sort = require('./sort');
@@ -44,13 +43,12 @@ assets['pages/article.html'] = {
}).join('');
var data = {
- "body": marked(repo.markup),
+ "body": repo.markup,
"difficulty": repo.meta.difficultyLabel || 'Unknown',
"created": repo.github.created_at,
"updated": repo.github.updated_at,
"contributorlist": assets['article_contributors.html'].compose(repo),
"articleCategories": articleCategories,
- //"categories": assets['categories.html'].compose(categories),
"tags": assets['tags.html'].compose(repo.meta.tags),
"suggestions": suggestionMarkup
};
View
@@ -11,6 +11,7 @@ var fs = require('fs'),
zlib = require('zlib'),
tar = require('tar'),
marked = require('github-flavored-markdown').parse,
+ hl = require("highlight").Highlight,
request = require('request'),
Plates = require('plates'),
difficulty = require('./difficulty'),
@@ -373,8 +374,8 @@ Content.prototype.getMarkup = function (repoName, filename, next) {
repo.files[filename] = {};
}
- repo.files[filename].markup = marked(data);
- repo.markup = data;
+ //repo.files[filename].markup = data;
+ repo.markup = hl(marked(data), false, true);;
next();
});
};

0 comments on commit ec959d1

Please sign in to comment.