Skip to content

Instantly share code, notes, and snippets.

@kukat
Last active November 14, 2016 13:49
Show Gist options
  • Save kukat/4647594 to your computer and use it in GitHub Desktop.
Save kukat/4647594 to your computer and use it in GitHub Desktop.
nvAlt with code highlight template.html
/*
This is my hacked up copy of Marked.app/Contents/Resources/gridless.css
Changes:
1. Smaller headings
2. ~~No scrollbars~~ (I now prefer the Lion default behavior)
3. Styling of definition lists ala LaTeX description lists.
4. Centering h1.title, h3.author, h4.date (pandoc's title/author/date block).
David Sanson <dsanson at gmail...>
*/
/*
This document has been created with Marked.app <http://markedapp.com>, Copyright 2011 Brett Terpstra
Please leave this notice in place, along with any additional credits below.
---------------------------------------------------------------
Gridless CSS, borrowed from the Gridless framework
Original information from gridless.css:
Main stylesheet: contains CSS normalization, base styles, typography with a vertical rhythm and some mobile-first media queries
Credit is left where credit is due
Much content and inspiration was taken from the normalize.css project: http://necolas.github.com/normalize.css/ and https://github.com/jonathantneal/normalize.css
*/
/* `HTML5 elements display-role
---------------------------------------- */
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section, dialog {
display: block;
}
/* `Base structure
---------------------------------------- */
html {
height: 100%;
font-size: 100%;
-webkit-text-size-adjust: 100%; /* Remove iOS text size adjust without disabling user zoom */
}
body {
margin: 0;
min-height: 100%;
font: 16px/1.625 Georgia, serif;
*font-size: 1em; /* IE7 and older: IE can't resize px based text and most mobiles don't default the text to 16px */
color: #222; /* Black on white is too much contrast, #222 is a lot better */
}
/* Font settings */
body, button, input, select, textarea {
font: 16px/1.625 Georgia, serif;
*font-size: 1em; /* IE7 and older: IE can't resize px based text and most mobiles don't default the text to 16px */
color: #222; /* Black on white is too much contrast, #222 is a lot better */
}
p, blockquote, q, pre, address, hr, code, samp, dl, ol, ul, form, table, fieldset, menu, h4, h5, h6, img {
margin: 0 0 1.625em;
}
/* `Headings and small
---------------------------------------- */
h1, h2, h3, h4, h5, h6 {
font-weight: bold;
font-family: 'Palatino', 'Palatino Linotype', 'Book Antiqua', 'FreeSerif', serif;
}
h1 {
font-size: 1.7em; /* 68px */
line-height: 1.1471em;
margin: 0 0 0.3824em;
}
h2 {
font-size: 1.5em; /* 42px */
line-height: 1.2381em;
margin: 0 0 0.619em;
}
h3 {
font-size: 1.25em; /* 26px */
line-height: 1em;
margin: 0 0 1em;
}
h4, h5, h6 {
font-size: 1em;
}
small {
font-size: 0.625em; /* 10px */
margin: 0 0 2.6em;
}
/* `Code
---------------------------------------- */
/* Allows line wrapping of 'pre' */
pre {
white-space: pre;
white-space: pre-wrap;
word-wrap: break-word;
}
pre, code, kbd, samp {
font: 1em/1.625em Menlo, Consolas, 'DejaVu Sans Mono', Monaco, monospace;
}
/* `Tables
---------------------------------------- */
table {
border-collapse: collapse;
border-spacing: 0;
}
th {
text-align: left;
}
tr, th, td {
padding-right: 1.625em;
border-bottom: 1px solid #333;
}
/* `Forms
---------------------------------------- */
form {
margin: 0;
}
fieldset {
border: 0;
padding: 0;
}
textarea {
overflow: auto;
vertical-align: top;
}
legend {
*margin-left: -7px;
}
button, input, select, textarea {
font: 1em/1.625em Georgia, serif;
color: #222;
vertical-align: baseline;
*vertical-align: middle; /* IE7 and older */
}
button, input {
line-height: normal;
*overflow: visible;
}
button, input[type="button"], input[type="reset"], input[type="submit"] {
cursor: pointer;
-webkit-appearance: button;
}
input[type="checkbox"], input[type="radio"] {
box-sizing: border-box;
}
input[type="search"] {
-webkit-appearance: textfield;
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box;
}
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
button::-moz-focus-inner, input::-moz-focus-inner {
border: 0;
padding: 0;
}
/* `Quotes
---------------------------------------- */
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after, q:before, q:after {
content: '';
content: none;
}
blockquote, q, cite {
font-style: italic;
}
blockquote {
padding-left: 1.625em;
border-left: 3px solid #ccc;
}
blockquote > p {
padding: 0;
}
/* `Lists
---------------------------------------- */
ul, ol {
list-style-position: inside;
padding: 0;
}
li ul, li ol {
margin: 0 1.625em;
}
dt {
font-weight: bold;
float: left;
clear: left;
padding-right: 1em;
}
dl {
padding: 0;
}
dd p {
display: inline;
}
/* `Hyperlinks
---------------------------------------- */
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a:focus {
outline: thin dotted;
}
/* Better CSS outline suppression: people.opera.com/patrickl/experiments/keyboard/test */
a:hover, a:active {
outline: none;
}
/* `Figures and images
---------------------------------------- */
figure {
margin: 0;
}
img {
border: 0;
-ms-interpolation-mode: bicubic; /* Improve IE's resizing of images: http://css-tricks.com/ie-fix-bicubic-scaling-for-images */
}
/* `Abbreviations
---------------------------------------- */
abbr[title], dfn[title] {
border-bottom: 1px dotted #333;
cursor: help;
}
/* `Marked/inserted and deleted text
---------------------------------------- */
ins, mark {
text-decoration: none;
}
mark {
background: #ff0;
}
ins {
background: #ff9;
}
del {
text-decoration: line-through;
}
/* `Others
---------------------------------------- */
strong, b, dt {
font-weight: bold;
}
dfn {
font-style: italic;
}
var, address {
font-style: normal;
}
/* Position 'sub' and 'sup' without affecting line-height: gist.github.com/413930 */
sub, sup {
font-size: 0.625em;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
/* `Clearfix hack: http://nicolasgallagher.com/micro-clearfix-hack/
---------------------------------------- */
.cf:before, .cf:after {
content: "";
display: table;
}
.cf:after {
clear: both;
}
.cf {
*zoom: 1;
}
/* `Default (mobile) styles
---------------------------------------- */
/* Centering pages without a wrapper: http://www.camendesign.com/code/developpeurs_sans_frontieres */
/* The body will work like a 'div#wrapper': add the background of the page to the 'html' tag and the background of the wrapper to the 'body' tag */
body {
width: 92%;
margin: 0 auto;
}
/* `Wide mobile devices styles
---------------------------------------- */
@media only screen and (min-width: 480px) {
body {
}
}
/* `Tablets/netbooks styles
---------------------------------------- */
@media only screen and (min-width: 768px) {
body {
}
}
/* `Desktop devices styles
---------------------------------------- */
@media only screen and (min-width: 1024px) {
body {
}
}
/* `Print styles
---------------------------------------- */
@media print {
* {
background: transparent !important;
color: black !important; /* The woes of CSS color in print typography: sanbeiji.com/archives/953 */
text-shadow: none !important;
filter: none !important;
-ms-filter: none !important;
}
a, a:visited {
color: #222 !important;
text-decoration: underline;
}
a[href]:after {
content: " (" attr(href) ")";
}
abbr[title]:after {
content: " (" attr(title) ")";
}
/* Do not show javascript and internal links */
a[href^="javascript:"]:after, a[href^="#"]:after {
content: "";
}
/* Printing Tables: css-discuss.incutio.com/wiki/Printing_Tables */
thead {
display: table-header-group;
}
tr, img {
page-break-inside: avoid;
}
@page {
margin: 0.5cm;
}
p, h2, h3 {
orphans: 3;
widows: 3;
}
h2, h3{
page-break-after: avoid;
}
}
.footnote {
font-size: .8em;
vertical-align: super;
color: rgb(13,110,161)
}
#contentdiv img {
max-width: 100%
}
@media print {body {
overflow: auto
}
#wrapper {
background: #fff;
position: relative
}
#contentdiv {
position: relative;
background: transparent;
color: #303030;
text-indent: 0px;
padding: 10px;
font-size:85%;
}
}
@media screen {
.inverted, .inverted #wrapper { background:#111 !important }
.inverted #contentdiv {background:transparent !important }
.inverted p,.inverted td,.inverted li,.inverted h1,.inverted h2,
.inverted h3,.inverted h4, .inverted h5, .inverted h6, .inverted pre,
.inverted code,.inverted th {
color:#eee !important;
}
.inverted a { color:#fff;text-decoration:underline }
#wrapper {
background: #fff;
}
#contentdiv {
background: transparent;
color: #303030;
overflow: auto;
text-indent: 0px;
padding: 15px;
margin: 10px;
}
}
.footnotes p {display:inline}
h1.title, h3.author, h4.date {
text-align: center;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{%title%}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
{%style%}
</style>
<link rel="stylesheet" href="http://yandex.st/highlightjs/7.3/styles/monokai.min.css">
</head>
<body>
<div id="wrapper">
<header>
<h1 class="doctitle">{%title%}</h1>
</header>
<div id="contentdiv">
{%content%}
</div>
</div> <!-- end of #container -->
<script src="http://yandex.st/highlightjs/7.3/highlight.min.js"></script>
<script src="http://code.jquery.com/jquery.min.js"></script>
<script type="text/javascript">
(function ($) {
$('h1,h2,h3,h4').each(function () {
$(this).html($(this).text().replace(/([^\s])\s+([^\s]{1,5})\s*$/, '$1&nbsp;$2'));
});
$('a[href^=#]').click(function () {
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
var $target = $(this.hash);
$target = $target.length && $target || $('[id=' + this.hash.slice(1) + ']');
if ($target.length) {
var targetOffset = $target.offset().top;
$('#contentdiv').animate({
scrollTop: targetOffset - 40
}, 1000);
return false;
}
}
});
$('#contentdiv').scroll(function () {
if (this.scrollTop > 150) {
if ($('#backtotop').length == 0) $('h1.doctitle').append($('<a href="javascript:void()" id="backtotop" />').text('Back to top').css({
'float': 'right',
'display': 'none'
}).click(function () {
$('#contentdiv').animate({
scrollTop: 0
}, 1000);
}));
$('#backtotop').fadeIn('slow');
} else {
$('#backtotop').fadeOut('slow', function () {
$(this).remove();
});
}
});
$('code').each(function( index ) {
var lang = $(this).prev('em');
if (lang.text().length > 0) {
lang.remove();
$(this).addClass(lang).wrap('<pre>');
}
});
})(jQuery);
hljs.initHighlightingOnLoad();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment