Browse Source

Highlight code in README files

Uses highlightjs
zudov-ghc-7.10
Konstantin Zudov 6 years ago
parent
commit
3f8d0b3916
  1. 4
      Handler/Package.hs
  2. 123
      static/css/highlight-github.css
  3. 1
      static/js/highlight.js
  4. 1
      templates/package.julius

4
Handler/Package.hs

@ -67,8 +67,12 @@ packagePage mversion pname = do
else ms
defaultLayout $ do
setTitle $ toHtml pname
$(combineScripts 'StaticR
[ js_highlight_js
])
$(combineStylesheets 'StaticR
[ css_font_awesome_min_css
, css_highlight_github_css
])
let pn = pname
toPkgVer x y = concat [x, "-", y]

123
static/css/highlight-github.css

@ -0,0 +1,123 @@
/*
github.com style (c) Vasily Polovnyov <vast@whiteants.net>
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
color: #333;
background: #f8f8f8;
-webkit-text-size-adjust: none;
}
.hljs-comment,
.diff .hljs-header {
color: #998;
font-style: italic;
}
.hljs-keyword,
.css .rule .hljs-keyword,
.hljs-winutils,
.nginx .hljs-title,
.hljs-subst,
.hljs-request,
.hljs-status {
color: #333;
font-weight: bold;
}
.hljs-number,
.hljs-hexcolor,
.ruby .hljs-constant {
color: #008080;
}
.hljs-string,
.hljs-tag .hljs-value,
.hljs-doctag,
.tex .hljs-formula {
color: #d14;
}
.hljs-title,
.hljs-id,
.scss .hljs-preprocessor {
color: #900;
font-weight: bold;
}
.hljs-list .hljs-keyword,
.hljs-subst {
font-weight: normal;
}
.hljs-class .hljs-title,
.hljs-type,
.vhdl .hljs-literal,
.tex .hljs-command {
color: #458;
font-weight: bold;
}
.hljs-tag,
.hljs-tag .hljs-title,
.hljs-rule .hljs-property,
.django .hljs-tag .hljs-keyword {
color: #000080;
font-weight: normal;
}
.hljs-attribute,
.hljs-variable,
.lisp .hljs-body,
.hljs-name {
color: #008080;
}
.hljs-regexp {
color: #009926;
}
.hljs-symbol,
.ruby .hljs-symbol .hljs-string,
.lisp .hljs-keyword,
.clojure .hljs-keyword,
.scheme .hljs-keyword,
.tex .hljs-special,
.hljs-prompt {
color: #990073;
}
.hljs-built_in {
color: #0086b3;
}
.hljs-preprocessor,
.hljs-pragma,
.hljs-pi,
.hljs-doctype,
.hljs-shebang,
.hljs-cdata {
color: #999;
font-weight: bold;
}
.hljs-deletion {
background: #fdd;
}
.hljs-addition {
background: #dfd;
}
.diff .hljs-change {
background: #0086b3;
}
.hljs-chunk {
color: #aaa;
}

1
static/js/highlight.js

File diff suppressed because one or more lines are too long

1
templates/package.julius

@ -0,0 +1 @@
hljs.initHighlightingOnLoad();
Loading…
Cancel
Save