Skip to content
Snippets Groups Projects
Commit 8646dc41 authored by Michi302's avatar Michi302
Browse files

Update highlight.js and set diff view typeface to monospace. Closes #106

parent 164f43ae
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -41,6 +41,7 @@ The following 3rd party libraries and resources are the reason this app works. R
- GitDiffTextView (https://github.com/alorma/GitDiffTextView)
- MaterialDateTimePicker (https://github.com/wdullaer/MaterialDateTimePicker)
- Crashlytics (https://www.crashlytics.com)
- highlight.js (https://highlightjs.org/)
 
## Contributing
Please fork this repository and contribute back! All Merge Requests should be made against the `develop` branch, as it is the active branch for development. Please make your best effort to break up commits as much as possible to improve the reviewing process.
Loading
Loading
Loading
Loading
@@ -4,124 +4,96 @@ github.com style (c) Vasily Polovnyov <vast@whiteants.net>
 
*/
 
pre code {
display: block; padding: 0.5em;
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
color: #333;
background: #FFFFFF
background: #f8f8f8;
}
 
pre .comment,
pre .template_comment,
pre .diff .header,
pre .javadoc {
.hljs-comment,
.hljs-quote {
color: #998;
font-style: italic
font-style: italic;
}
 
pre .keyword,
pre .css .rule .keyword,
pre .winutils,
pre .javascript .title,
pre .nginx .title,
pre .subst,
pre .request,
pre .status {
.hljs-keyword,
.hljs-selector-tag,
.hljs-subst {
color: #333;
font-weight: bold
font-weight: bold;
}
 
pre .number,
pre .hexcolor,
pre .ruby .constant {
color: #099;
.hljs-number,
.hljs-literal,
.hljs-variable,
.hljs-template-variable,
.hljs-tag .hljs-attr {
color: #008080;
}
 
pre .string,
pre .tag .value,
pre .phpdoc,
pre .tex .formula {
color: #d14
.hljs-string,
.hljs-doctag {
color: #d14;
}
 
pre .title,
pre .id {
.hljs-title,
.hljs-section,
.hljs-selector-id {
color: #900;
font-weight: bold
font-weight: bold;
}
 
pre .javascript .title,
pre .lisp .title,
pre .clojure .title,
pre .subst {
font-weight: normal
.hljs-subst {
font-weight: normal;
}
 
pre .class .title,
pre .haskell .type,
pre .vhdl .literal,
pre .tex .command {
.hljs-type,
.hljs-class .hljs-title {
color: #458;
font-weight: bold
font-weight: bold;
}
 
pre .tag,
pre .tag .title,
pre .rules .property,
pre .django .tag .keyword {
.hljs-tag,
.hljs-name,
.hljs-attribute {
color: #000080;
font-weight: normal
font-weight: normal;
}
 
pre .attribute,
pre .variable,
pre .lisp .body {
color: #008080
.hljs-regexp,
.hljs-link {
color: #009926;
}
 
pre .regexp {
color: #009926
.hljs-symbol,
.hljs-bullet {
color: #990073;
}
 
pre .class {
color: #458;
font-weight: bold
}
pre .symbol,
pre .ruby .symbol .string,
pre .lisp .keyword,
pre .tex .special,
pre .prompt {
color: #990073
}
pre .built_in,
pre .lisp .title,
pre .clojure .built_in {
color: #0086b3
.hljs-built_in,
.hljs-builtin-name {
color: #0086b3;
}
 
pre .preprocessor,
pre .pi,
pre .doctype,
pre .shebang,
pre .cdata {
.hljs-meta {
color: #999;
font-weight: bold
font-weight: bold;
}
 
pre .deletion {
background: #fdd
.hljs-deletion {
background: #fdd;
}
 
pre .addition {
background: #dfd
.hljs-addition {
background: #dfd;
}
 
pre .diff .change {
background: #0086b3
.hljs-emphasis {
font-style: italic;
}
 
pre .chunk {
color: #aaa
.hljs-strong {
font-weight: bold;
}
Source diff could not be displayed: it is too large. Options to address this: view the blob.
Loading
Loading
@@ -111,11 +111,28 @@ public class FileActivity extends BaseActivity {
if (mimeType != null && mimeType.startsWith("image/")) {
String imageURL = "data:" + mimeType + ";base64," + response.body().getContent();
 
content = "<!DOCTYPE html><html><head><link href=\"github.css\" rel=\"stylesheet\" /></head><body><img style=\"width: 100%;\" src=\"" + imageURL + "\"></body></html>";
content = "<!DOCTYPE html>" +
"<html>" +
"<body>" +
"<img style=\"width: 100%;\" src=\"" + imageURL + "\">" +
"</body>" +
"</html>";
} else {
String text = new String(mBlob, Charset.forName("UTF-8"));
 
content = "<!DOCTYPE html><html><head><link href=\"github.css\" rel=\"stylesheet\" /></head><body><pre><code>" + Html.escapeHtml(text) + "</code></pre><script src=\"highlight.pack.js\"></script><script>hljs.initHighlightingOnLoad();</script></body></html>";
content = "<!DOCTYPE html>" +
"<html>" +
"<head>" +
"<link href=\"github.css\" rel=\"stylesheet\" />" +
"</head>" +
"<body>" +
"<pre><code>" +
Html.escapeHtml(text) +
"</code></pre>" +
"<script src=\"highlight.pack.js\"></script>" +
"<script>hljs.initHighlightingOnLoad();</script>" +
"</body>" +
"</html>";
}
 
mFileBlobView.loadDataWithBaseURL("file:///android_asset/", content, "text/html", "utf8", null);
Loading
Loading
Loading
Loading
@@ -30,6 +30,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:typeface="monospace"
tools:text="+blah blah blah"/>
 
</LinearLayout>
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment