Merge pull request #37 from maciejsmolinski/master
Hooks and Code Highlighting
This commit is contained in:
@@ -7,6 +7,15 @@ var timerDelay = iosDetected ? 800 : 400;
|
||||
var $note, $action, $preview, $plain_password, $tableau;
|
||||
var backendTimer;
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
marked.setOptions({
|
||||
langPrefix: 'hljs lang-',
|
||||
highlight: function (code) {
|
||||
return hljs.highlightAuto(code).value;
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
function md2html(input) {
|
||||
return marked(input);
|
||||
}
|
||||
@@ -21,7 +30,7 @@ function saveDraft() {
|
||||
function enableButton() {
|
||||
var checkbox = $('tos');
|
||||
var button = $('publish-button');
|
||||
button.disabled = !checkbox.checked;
|
||||
button.disabled = !checkbox.checked;
|
||||
}
|
||||
|
||||
function onLoad() {
|
||||
|
||||
+90
-14
@@ -185,18 +185,6 @@ blockquote {
|
||||
margin-bottom: 7em;
|
||||
}
|
||||
|
||||
code, pre {
|
||||
font-size: 1.05em;
|
||||
background: #efefef;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
pre {
|
||||
border: 1px solid #aaa;
|
||||
padding: 0.5em;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
*:focus {
|
||||
outline: 0px none transparent;
|
||||
}
|
||||
@@ -222,7 +210,7 @@ td {
|
||||
padding: 0.5em;
|
||||
}
|
||||
|
||||
/* MEDIA QUERIES */
|
||||
/* MEDIA QUERIES */
|
||||
|
||||
@media screen and (min-width: 1024px) {
|
||||
article, .central-element {
|
||||
@@ -308,4 +296,92 @@ fieldset {
|
||||
|
||||
#plain-password {
|
||||
width: 10em;
|
||||
}
|
||||
}
|
||||
|
||||
/* SYNTAX HIGHLIGHTING */
|
||||
|
||||
/* Theme: default, source: http://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.5.0/styles/default.min.css */
|
||||
.hljs {
|
||||
display:block;
|
||||
overflow-x:auto;
|
||||
padding:0.5em;
|
||||
background:#F0F0F0
|
||||
}
|
||||
.hljs,
|
||||
.hljs-subst {
|
||||
color:#444
|
||||
}
|
||||
.hljs-comment {
|
||||
color:#888888
|
||||
}
|
||||
.hljs-keyword,
|
||||
.hljs-attribute,
|
||||
.hljs-selector-tag,
|
||||
.hljs-meta-keyword,
|
||||
.hljs-doctag,
|
||||
.hljs-name {
|
||||
font-weight:bold
|
||||
}
|
||||
.hljs-type,
|
||||
.hljs-string,
|
||||
.hljs-number,
|
||||
.hljs-selector-id,
|
||||
.hljs-selector-class,
|
||||
.hljs-quote,
|
||||
.hljs-template-tag,
|
||||
.hljs-deletion {
|
||||
color:#880000
|
||||
}
|
||||
.hljs-title,
|
||||
.hljs-section {
|
||||
color:#880000;
|
||||
font-weight:bold
|
||||
}
|
||||
.hljs-regexp,
|
||||
.hljs-symbol,
|
||||
.hljs-variable,
|
||||
.hljs-template-variable,
|
||||
.hljs-link,
|
||||
.hljs-selector-attr,
|
||||
.hljs-selector-pseudo {
|
||||
color:#BC6060
|
||||
}
|
||||
.hljs-literal {
|
||||
color:#78A960
|
||||
}
|
||||
.hljs-built_in,
|
||||
.hljs-bullet,
|
||||
.hljs-code,
|
||||
.hljs-addition {
|
||||
color:#397300
|
||||
}
|
||||
.hljs-meta {
|
||||
color:#1f7199
|
||||
}
|
||||
.hljs-meta-string {
|
||||
color:#4d99bf
|
||||
}
|
||||
.hljs-emphasis {
|
||||
font-style:italic
|
||||
}
|
||||
.hljs-strong {
|
||||
font-weight:bold
|
||||
}
|
||||
|
||||
|
||||
pre, code, code.hljs {
|
||||
font-family: monospace;
|
||||
border-radius: 3px;
|
||||
background: #f0f0f0;
|
||||
font-size: 1.05em;
|
||||
}
|
||||
|
||||
/* Don't increase the size of code in pre tag, pre tag already did it.
|
||||
Otherwise code size would be even bigger (1.05em * 1.05em = 1.1025em) */
|
||||
pre code {
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
code.hljs {
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user