Skip to content

Commit

Permalink
Merge pull request previm#29 from Bakudankun/fix-highlight
Browse files Browse the repository at this point in the history
Fix a bug which ignores language specification at ``` block
  • Loading branch information
kannokanno committed Jan 11, 2015
2 parents f576d7d + 5c65bf1 commit 61b7a7c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
18 changes: 7 additions & 11 deletions preview/css/lib/github.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ github.com style (c) Vasily Polovnyov <[email protected]>
}

.hljs-comment,
.hljs-template_comment,
.diff .hljs-header,
.hljs-javadoc {
color: #998;
Expand All @@ -24,7 +23,6 @@ github.com style (c) Vasily Polovnyov <[email protected]>
.hljs-keyword,
.css .rule .hljs-keyword,
.hljs-winutils,
.javascript .hljs-title,
.nginx .hljs-title,
.hljs-subst,
.hljs-request,
Expand All @@ -36,33 +34,31 @@ github.com style (c) Vasily Polovnyov <[email protected]>
.hljs-number,
.hljs-hexcolor,
.ruby .hljs-constant {
color: #099;
color: #008080;
}

.hljs-string,
.hljs-tag .hljs-value,
.hljs-phpdoc,
.hljs-dartdoc,
.tex .hljs-formula {
color: #d14;
}

.hljs-title,
.hljs-id,
.coffeescript .hljs-params,
.scss .hljs-preprocessor {
color: #900;
font-weight: bold;
}

.javascript .hljs-title,
.lisp .hljs-title,
.clojure .hljs-title,
.hljs-list .hljs-keyword,
.hljs-subst {
font-weight: normal;
}

.hljs-class .hljs-title,
.haskell .hljs-type,
.hljs-type,
.vhdl .hljs-literal,
.tex .hljs-command {
color: #458;
Expand Down Expand Up @@ -90,14 +86,14 @@ github.com style (c) Vasily Polovnyov <[email protected]>
.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,
.lisp .hljs-title,
.clojure .hljs-built_in {
.hljs-built_in {
color: #0086b3;
}

Expand Down
3 changes: 2 additions & 1 deletion preview/js/lib/highlight.pack.js

Large diffs are not rendered by default.

7 changes: 1 addition & 6 deletions preview/js/previm.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@

function transform(filetype, content) {
if(hasTargetFileType(filetype, ['markdown', 'mkd'])) {
marked.setOptions({
langPrefix: '',
highlight: function (code) {
return hljs.highlightAuto(code).value;
}
});
return marked(content);
} else if(hasTargetFileType(filetype, ['rst'])) {
// It has already been converted by rst2html.py
Expand Down Expand Up @@ -63,6 +57,7 @@
}
if (needReload && (typeof getContent === 'function') && (typeof getFileType === 'function')) {
_doc.getElementById('preview').innerHTML = transform(getFileType(), getContent());
Array.prototype.forEach.call(_doc.querySelectorAll('pre code'), hljs.highlightBlock);
autoScroll('body');
}
}
Expand Down

0 comments on commit 61b7a7c

Please sign in to comment.