Back on prismjs <https://prismjs.com/> for syntax highlighting.

While Pandoc was generating something sane, the output of CodeHilite puts silly amount of extra text and makes the HTML output completely unreadable.

In the end, it still looks like prism.js is a nice and solid solution, even if it's JS.

I'll explore other options, but so far, it's either back to Pandoc, or sticking with Prism.
This commit is contained in:
Peter Molnar 2018-08-02 22:47:49 +01:00
parent 3d68fb335c
commit 96d0c238d6
11 changed files with 689 additions and 927 deletions

57
html5_fenced_code.py Normal file
View file

@ -0,0 +1,57 @@
"""
This is a simplified FencedBlockPreprocessor which outputs "proper" <code>
naming, eg. language-python, instead of just python, so prism.js understands
it.
It doesn't deal with CodeHilite.
"""
from markdown.preprocessors import Preprocessor
from markdown.extensions import Extension
from markdown.extensions.fenced_code import FencedBlockPreprocessor
class HTML5FencedBlockPreprocessor(Preprocessor):
FENCED_BLOCK_RE = FencedBlockPreprocessor.FENCED_BLOCK_RE
CODE_WRAP = '<pre><code%s>%s</code></pre>'
LANG_TAG = ' class="language-%s"'
def __init__(self, md):
super(HTML5FencedBlockPreprocessor, self).__init__(md)
def run(self, lines):
text = "\n".join(lines)
while 1:
m = self.FENCED_BLOCK_RE.search(text)
if m:
lang = ''
if m.group('lang'):
lang = self.LANG_TAG % (m.group('lang'))
code = self.CODE_WRAP % (
lang,
m.group('code')
)
placeholder = self.markdown.htmlStash.store(code)
text = '%s\n%s\n%s' % (
text[:m.start()],
placeholder,
text[m.end():]
)
else:
break
return text.split("\n")
class HTML5FencedCodeExtension(Extension):
def extendMarkdown(self, md, md_globals):
md.registerExtension(self)
md.preprocessors.add(
'html5_fenced_code',
HTML5FencedBlockPreprocessor(md),
">normalize_whitespace"
)
def makeExtension(*args, **kwargs):
return HTML5FencedCodeExtension(*args, **kwargs)

38
nasg.py
View file

@ -35,6 +35,7 @@ import requests
import exiftool
import settings
import keys
import html5_fenced_code
from pprint import pprint
@ -63,13 +64,21 @@ RE_HTTP = re.compile(
MD = markdown.Markdown(
output_format='xhtml5',
extensions=[
'extra',
'codehilite',
'html5_fenced_code',
'abbr',
'attr_list',
'def_list',
'footnotes',
'tables',
'smart_strong',
'headerid',
'urlize'
],
'urlize',
]
)
RE_CODE = re.compile(
r'(?:[~`]{3})(?:[^`]+)?'
)
class MarkdownDoc(object):
@property
@ -412,6 +421,13 @@ class Singular(MarkdownDoc):
r[t][mtime] = c.tmplvars
return r
@property
def has_code(self):
if RE_CODE.search(self.content):
return True
else:
return False
@property
@cached()
def tmplvars(self):
@ -433,6 +449,7 @@ class Singular(MarkdownDoc):
'syndicate': self.syndicate,
'url': self.url,
'review': self.meta.get('review', False),
'has_code': self.has_code,
}
if (self.enclosure):
v.update({'enclosure': self.enclosure})
@ -521,8 +538,8 @@ class WebImage(object):
return self.mdimg.match
tmpl = J2.get_template("%s.j2.html" % (self.__class__.__name__))
return tmpl.render({
'src': self.displayed.relpath,
'href': self.linked.relpath,
'src': self.src,
'href': self.href,
'width': self.displayed.width,
'height': self.displayed.height,
'title': self.title,
@ -1315,7 +1332,14 @@ def make():
logging.info('worker finished')
# copy static
for e in glob.glob(os.path.join(content, '*.*')):
staticfiles = []
staticpaths = [
os.path.join(content, '*.*'),
os.path.join(settings.paths.get('tmpl'), '*.js')
]
for p in staticpaths:
staticfiles = staticfiles + glob.glob(p)
for e in staticfiles:
t = os.path.join(
settings.paths.get('build'),
os.path.basename(e)

2
run
View file

@ -5,4 +5,4 @@ IFS=$'\n\t'
source ./.venv/bin/activate
python3 nasg.py "$@"
rsync -avu --delete-after ../www/ liveserver:/web/petermolnar.net/web/
rsync -avuhH --delete-after ../www/ liveserver:/web/petermolnar.net/web/

View file

@ -1,19 +1,19 @@
<!DOCTYPE html>
<html {% block lang %}lang="{{ post.lang }}"{% endblock %}>
<head>
<title>{% block title %}{{ post.title }} - petermolnar.net{% endblock %}</title>
<title>{% block title %}{{ post.title }} - {{ site.domain }}{% endblock %}</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1" />
<link rel="icon" href="https://petermolnar.net/favicon.ico" />
<link rel="icon" href="{{ site.url }}/favicon.ico" />
{% for key, value in meta.items() %}
<link rel="{{ key }}" href="{{ value }}" />
{% endfor %}
{% block meta %}{% endblock %}
<style media="all">
{% include 'style-dark.css' %}
{% include 'style.css' %}
</style>
<style id="css_alternative" media="none">
{% include 'style-light.css' %}
<style id="css_alt" media="none">
{% include 'style-alt.css' %}
</style>
<style media="print">
{% include 'style-print.css' %}
@ -22,12 +22,12 @@
/* color scheme switcher */
var current = localStorage.getItem("stylesheet");
if (current) {
document.querySelector('#css_alternative').setAttribute("media", current);
document.querySelector('#css_alt').setAttribute("media", current);
}
function toggleStylesheet(trigger){
var setto = 'all';
var e = document.querySelector('#css_alternative');
var e = document.querySelector('#css_alt');
if (e.getAttribute("media") == 'all') {
setto = 'none';
}
@ -35,13 +35,19 @@
e.setAttribute("media", setto);
}
</script>
{% if post.has_code %}
<style media="all">
{% include 'prism.css' %}
</style>
<script src="{{ site.url }}/prism.js"></script>
{% endif %}
</head>
<body>
{% macro activemenu(name) %}{% if (post is defined and post.category == name ) or ( category is defined and category.name == name ) %}active{% endif %}{% endmacro %}
<header class="content-header">
<nav class="content-navigation">
<header>
<nav>
<ul>
<li>
<a title="home" href="/" class="{{ activemenu('') }}">
@ -76,11 +82,10 @@
</ul>
</nav>
<form role="search" method="get" class="search-form" action="/search.php">
<form role="search" method="get" action="/search.php">
<label for="s">Search</label>
<input type="search" class="search-field" placeholder="search..."
value="" name="q" id="q" title="Search for:" />
<input type="submit" class="search-submit" value="Go ➡" />
<input type="search" placeholder="search..." value="" name="q" id="q" title="Search for:" />
<input type="submit" value="Go ➡" />
</form>
<p class="contrast">
@ -94,7 +99,7 @@
</header>
{% block content %}
<section class="content-body">
<section>
<article class="h-entry hentry singular" lang="{{ post.lang }}">
<header>
<h1>
@ -144,9 +149,7 @@
{% endif %}
<div class="e-content entry-content">
<div class="content-inner">
{{ post.html_content }}
</div>
{{ post.html_content }}
</div>
<footer>
@ -336,90 +339,92 @@
{% endblock %}
<footer class="content-footer" id="main-footer">
<nav class="footer-contact p-author h-card vcard limit">
<h2>Contact</h2>
<div class="twothird">
<dl>
<dt>
<img class="photo avatar u-photo u-avatar"
src="https://petermolnar.net/molnar_peter_avatar.jpg"
alt="Photo of Peter Molnar" />
</dt>
<dd>
<a class="fn p-name url u-url u-uid" href="/about.html">
Peter Molnar
</a>
</dd>
<dt>email</dt>
<dd>
<a rel="me" class="u-email email" href="mailto:{{ author.email }}">
{{ author.email }}
</a>
</dd>
{% if author.gpg %}
<dt>GPG</dt>
<dd>
<a rel="me" class="u-gpg gpg" href="/{{ author.gpg }}">key</a>
</dd>
{% endif %}
<dt>url</dt>
<dd>
<a rel="me" class="u-url url" href="{{ author.url }}">
{{ author.url }}
</a>
</dd>
</dl>
<footer>
<div class="limit">
<nav class="p-author h-card vcard">
<h2>Contact</h2>
<div>
<dl>
<dt>
<img class="photo avatar u-photo u-avatar"
src="https://petermolnar.net/molnar_peter_avatar.jpg"
alt="Photo of Peter Molnar" />
</dt>
<dd>
<a class="fn p-name url u-url u-uid" href="/about.html">
Peter Molnar
</a>
</dd>
<dt>email</dt>
<dd>
<a rel="me" class="u-email email" href="mailto:{{ author.email }}">
{{ author.email }}
</a>
</dd>
{% if author.gpg %}
<dt>GPG</dt>
<dd>
<a rel="me" class="u-gpg gpg" href="/{{ author.gpg }}">key</a>
</dd>
{% endif %}
<dt>url</dt>
<dd>
<a rel="me" class="u-url url" href="{{ author.url }}">
{{ author.url }}
</a>
</dd>
</dl>
</div>
<div>
<dl>
{% if author.xmpp %}
<dt>XMPP</dt>
<dd>
<a rel="me" class="u-xmpp xmpp" href="xmpp:{{ author.xmpp }}">{{ author.xmpp }}</a>
</dd>
{% endif %}
{% if author.sip %}
<dt>SIP</dt>
<dd>
<a rel="me" class="u-sip sip" href="sip:{{ author.sip }}">
{{ author.sip }}
</a>
</dd>
{% endif %}
{% if author.icq %}
<dt>ICQ</dt>
<dd>
<a rel="me" class="u-icq icq" href="icq:{{ author.icq }}">
{{ author.icq }}
</a>
</dd>
{% endif %}
{% if author.flickr %}
<dt>flickr</dt>
<dd>
<a rel="me" class="u-flickr" href="https://flickr.com/people/{{ author.flickr }}">{{ author.flickr }}</a>
</dd>
{% endif %}
{% if author.github %}
<dt>github</dt>
<dd>
<a rel="me" class="u-github" href="https://github.com/{{ author.github }}">{{ author.github }}</a>
</dd>
{% endif %}
{% if author.twitter %}
<dt>twitter</dt>
<dd>
<a rel="me" class="u-twitter" href="https://twitter.com/{{ author.twitter }}">{{ author.twitter }}</a>
</dd>
{% endif %}
</dl>
</div>
</nav>
<div class="webring">
<a href="https://xn--sr8hvo.ws/🇻🇮📢/previous"></a>
Member of <a href="https://xn--sr8hvo.ws">IndieWeb Webring</a> 🕸💍
<a href="https://xn--sr8hvo.ws/🇻🇮📢/next"></a>
</div>
<div class="onethird">
<dl>
{% if author.xmpp %}
<dt>XMPP</dt>
<dd>
<a rel="me" class="u-xmpp xmpp" href="xmpp:{{ author.xmpp }}">{{ author.xmpp }}</a>
</dd>
{% endif %}
{% if author.sip %}
<dt>SIP</dt>
<dd>
<a rel="me" class="u-sip sip" href="sip:{{ author.sip }}">
{{ author.sip }}
</a>
</dd>
{% endif %}
{% if author.icq %}
<dt>ICQ</dt>
<dd>
<a rel="me" class="u-icq icq" href="icq:{{ author.icq }}">
{{ author.icq }}
</a>
</dd>
{% endif %}
{% if author.flickr %}
<dt>flickr</dt>
<dd>
<a rel="me" class="u-flickr" href="https://flickr.com/people/{{ author.flickr }}">{{ author.flickr }}</a>
</dd>
{% endif %}
{% if author.github %}
<dt>github</dt>
<dd>
<a rel="me" class="u-github" href="https://github.com/{{ author.github }}">{{ author.github }}</a>
</dd>
{% endif %}
{% if author.twitter %}
<dt>twitter</dt>
<dd>
<a rel="me" class="u-twitter" href="https://twitter.com/{{ author.twitter }}">{{ author.twitter }}</a>
</dd>
{% endif %}
</dl>
</div>
</nav>
<div class="webring">
<a href="https://xn--sr8hvo.ws/🇻🇮📢/previous"></a>
Member of <a href="https://xn--sr8hvo.ws">IndieWeb Webring</a> 🕸💍
<a href="https://xn--sr8hvo.ws/🇻🇮📢/next"></a>
</div>
</footer>

73
templates/prism.css Normal file
View file

@ -0,0 +1,73 @@
.token.comment,
.token.block-comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: darkgray;
}
.token.punctuation {
color:darkcyan;
}
.token.tag,
.token.attr-name,
.token.namespace,
.token.deleted {
color: #e2777a;
}
.token.function-name {
color: red;
}
.token.boolean,
.token.number,
.token.function {
color: #f08d49;
}
.token.property,
.token.class-name,
.token.constant,
.token.symbol {
color: #f8c555;
}
.token.selector,
.token.important,
.token.atrule,
.token.keyword,
.token.builtin {
color: darkorange;
}
.token.string,
.token.char,
.token.attr-value,
.token.regex,
.token.variable {
color:darkred;
}
.token.operator,
.token.entity,
.token.url {
color: darkmagenta;
}
.token.important,
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
.token.entity {
cursor: help;
}
.token.inserted {
color: green;
}

26
templates/prism.js Normal file

File diff suppressed because one or more lines are too long

29
templates/style-alt.css Normal file
View file

@ -0,0 +1,29 @@
body {
color: #222;
background-color: #eee;
}
a {
color: #3173b4;
}
a:hover {
color: #014384;
}
code,
pre {
color: darkgreen;
}
.contrast svg {
transform: rotate(180deg);
}
blockquote {
color: #555;
}
td, th {
border: 1px solid #111;
}

View file

@ -1,583 +0,0 @@
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
transition: all 0.2s;
padding: 0;
margin: 0;
}
html,
.content-footer,
.content-header {
position: relative;
background-color: #111;
color: #bbb;
}
html, body {
min-height: 100%;
font-family: "Liberation Sans", sans-serif;
color: #ccc;
background-color: #222;
font-size: 102%;
}
hr {
border: none;
border-top: 1px solid #777;
margin: 1em 0;
clear:both;
}
a {
color: #5193D4;
border-bottom: 1px solid transparent;
text-decoration: none;
}
a:hover {
color: #71B3F4;
border-bottom: 1px solid #71B3F4;
}
ul,
ol {
margin-left: 2em;
}
dd {
margin-left: 1em;
}
dt {
font-weight: bold;
margin: 1em 0;
}
li {
margin: 0.3em 0;
}
p {
margin: 1.2em 0;
line-height: 1.3em;
}
h1,
h2,
h3,
h4,
h5,
h6 {
margin: 1em 0 0.6em 0;
padding: 0.3em 0;
line-height: 1.2em;
}
h1 {
font-size: 1.6em;
}
h2 {
font-size: 1.4em;
}
h3 {
font-size: 1.2em;
}
h4 {
font-size: 1em;
}
h5 {
font-size: 1em;
}
h6 {
font-size: 1em;
}
table {
border-collapse: collapse;
border-spacing: 0;
width: 100%;
}
td,
th {
padding: 0.3em;
border: 1px solid #111;
text-align:left;
}
th {
font-weight: bold;
background-color: #222;
}
tr:nth-child(odd) {
background-color: #333;
}
tr:nth-child(even) {
background-color: #444;
}
blockquote {
margin: 0.6em;
padding-left: 0.6em;
border-left: 3px solid #999;
color: #999;
}
input {
border: none;
border-bottom: 3px solid #999;
background-color: transparent;
color: #ccc;
}
input:focus,
input:hover {
border-bottom: 3px solid #fff;
color: #fff;
}
code,
pre,
q {
font-family: "Courier New", "Courier", monospace;
font-size: 0.94em;
}
code,
pre {
color: limegreen;
background-color: #222;
border: 1px solid #666;
direction: ltr;
text-align: left;
tab-size: 2;
}
pre code {
border: none;
}
pre {
overflow: auto;
padding: 0.6em;
}
code {
padding: 0.1em;
}
.codehilite .hll { background-color: #222222 }
.codehilite { background: #000000; color: #cccccc }
.codehilite .c { color: #000080 }
.codehilite .err { color: #cccccc; border: 1px solid #FF0000 }
.codehilite .esc { color: #cccccc }
.codehilite .g { color: #cccccc }
.codehilite .k { color: #cdcd00 }
.codehilite .l { color: #cccccc }
.codehilite .n { color: #cccccc }
.codehilite .o { color: #3399cc }
.codehilite .x { color: #cccccc }
.codehilite .p { color: #cccccc }
.codehilite .ch { color: #000080 }
.codehilite .cm { color: #000080 }
.codehilite .cp { color: #000080 }
.codehilite .cpf { color: #000080 }
.codehilite .c1 { color: #000080 }
.codehilite .cs { color: #cd0000; font-weight: bold }
.codehilite .gd { color: #cd0000 }
.codehilite .ge { color: #cccccc; font-style: italic }
.codehilite .gr { color: #FF0000 }
.codehilite .gh { color: #000080; font-weight: bold }
.codehilite .gi { color: #00cd00 }
.codehilite .go { color: #888888 }
.codehilite .gp { color: #000080; font-weight: bold }
.codehilite .gs { color: #cccccc; font-weight: bold }
.codehilite .gu { color: #800080; font-weight: bold }
.codehilite .gt { color: #0044DD }
.codehilite .kc { color: #cdcd00 }
.codehilite .kd { color: #00cd00 }
.codehilite .kn { color: #cd00cd }
.codehilite .kp { color: #cdcd00 }
.codehilite .kr { color: #cdcd00 }
.codehilite .kt { color: #00cd00 }
.codehilite .ld { color: #cccccc }
.codehilite .m { color: #cd00cd }
.codehilite .s { color: #cd0000 }
.codehilite .na { color: #cccccc }
.codehilite .nb { color: #cd00cd }
.codehilite .nc { color: #00cdcd }
.codehilite .no { color: #cccccc }
.codehilite .nd { color: #cccccc }
.codehilite .ni { color: #cccccc }
.codehilite .ne { color: #666699; font-weight: bold }
.codehilite .nf { color: #cccccc }
.codehilite .nl { color: #cccccc }
.codehilite .nn { color: #cccccc }
.codehilite .nx { color: #cccccc }
.codehilite .py { color: #cccccc }
.codehilite .nt { color: #cccccc }
.codehilite .nv { color: #00cdcd }
.codehilite .ow { color: #cdcd00 }
.codehilite .w { color: #cccccc }
.codehilite .mb { color: #cd00cd }
.codehilite .mf { color: #cd00cd }
.codehilite .mh { color: #cd00cd }
.codehilite .mi { color: #cd00cd }
.codehilite .mo { color: #cd00cd }
.codehilite .sa { color: #cd0000 }
.codehilite .sb { color: #cd0000 }
.codehilite .sc { color: #cd0000 }
.codehilite .dl { color: #cd0000 }
.codehilite .sd { color: #cd0000 }
.codehilite .s2 { color: #cd0000 }
.codehilite .se { color: #cd0000 }
.codehilite .sh { color: #cd0000 }
.codehilite .si { color: #cd0000 }
.codehilite .sx { color: #cd0000 }
.codehilite .sr { color: #cd0000 }
.codehilite .s1 { color: #cd0000 }
.codehilite .ss { color: #cd0000 }
.codehilite .bp { color: #cd00cd }
.codehilite .fm { color: #cccccc }
.codehilite .vc { color: #00cdcd }
.codehilite .vg { color: #00cdcd }
.codehilite .vi { color: #00cdcd }
.codehilite .vm { color: #00cdcd }
.codehilite .il { color: #cd00cd }
.limit,
.content-body {
max-width: 86ch;
margin: 0 auto;
padding: 0.6em;
}
.icon {
transform: rotate(0deg);
width: 16px;
height: 16px;
display: inline-block;
fill: currentColor;
overflow: visible;
vertical-align:text-top;
margin: 0 0.1em;
}
.content-header {
font-size: 1.1em;
text-align:center;
padding: 0 0 1em 0;
}
.content-navigation ul {
list-style-type: none;
margin: 0;
}
.content-navigation ul li {
display: inline-block;
padding-right: 0.6em;
}
.content-header a {
font-weight: bold;
border-bottom: 3px solid transparent !important;;
color: #ccc !important;;
}
.content-header a:hover {
border-bottom: 3px solid #fefefe !important;;
}
.content-navigation ul li a.active {
border-bottom: 3px solid #ccc !important;
}
.content-navigation ul li a svg {
display:block;
margin: 0.1em auto;
}
.search-form label {
display: none;
}
.search-form {
margin: 0.6em;
}
.search-form .search-field {
width: 10em;
}
.contrast {
position: absolute;
top:0.6em;
right: 0.6em;
margin: 0;
padding: 0;
}
.contrast.active {
transform: rotate(180deg);
}
@media all and (min-width: 56em) {
.content-header {
display: flex;
justify-content: space-between;
padding: 0.6em 0.3em;
}
.content-navigation ul li a {
padding-bottom: 0.1em;
}
.content-navigation ul li a svg {
display:inline-block;
}
.search-form {
margin: 0.3em 2em 0 auto;
}
.contrast {
top:1em;
}
}
figure {
position:relative;
overflow: hidden;
margin: 2em 0;
}
figure figcaption {
padding: 0.3em 0;
text-align: center;
}
.adaptimg {
display: block;
max-height: 98vh;
max-width: 100%;
width:auto;
height:auto;
margin: 0 auto;
padding: 0;
border: 1px solid #000;
}
.h-feed figcaption {
display: none;
}
.exif {
font-size: 0.8em;
margin: 0.3em 0;
}
.exif dt {
display: none;
}
.exif dd {
display: inline-block;
margin: 0 0.6em 0 0;
padding: 0.3em 0;
}
.exif .icon {
width: 1em;
}
.footnote-ref {
border: 0;
white-space: nowrap;
margin-left: 0.2em;
}
.footnote-ref::before {
content: '[';
}
.footnote-ref::after {
content: ']';
}
.footnote ol li p {
margin: 0;
padding: 0;
}
.footnote ol li a {
display: inline-block;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
vertical-align: top;
max-width: 80%;
}
.footnote ol li a[href^="#"] {
margin-left: 0.6em;
max-width: 20%;
font-size: 0.6em;
}
.footnote ol li a[href^="#"]:after {
content: "back to text";
margin-left: 0.2em;
color: #666;
}
.footnote ol li a[href^="#"]:hover:after {
color: #ccc;
}
.twothird {
display: inline-block;
width: 65%;
vertical-align:text-top;
}
.onethird {
display: inline-block;
width: 33%;
vertical-align:text-top;
}
.content-footer {
margin-top: 2em;
padding: 1em 0;
color: #999;
}
.content-footer h2 {
display: none;
color: #999;
}
.content-footer a {
color: #999;
}
.content-footer a:hover {
color: #fff;
}
.content-footer dl {
position: relative;
}
.content-footer dt {
display: block;
}
.content-footer dd {
display: block;
margin: -2.3em 0 0 4em;
}
.content-footer img {
width: 1em;
}
body svg,
body script {
display: none;
}
.p-author img {
height: 1em;
width: auto;
}
.reactions dt {
display: none;
}
.reactions ul {
list-style-type: none;
margin: 0;
}
.h-feed h2,
.h-entry.singular .e-content h2 {
border-bottom: 2px solid #999;
}
.h-feed h3,
.h-entry.singular .e-content h3 {
border-bottom: 1px dotted #777;
}
.h-feed > h1 {
display: none;
}
.h-feed h3 {
font-size: 1.1em;
}
.h-entry.singular h1 a {
color: #ccc;
}
.pagination {
margin: 2em 0 0 0;
font-size: 1.4em;
}
.pagination ul {
list-style-type: none;
text-align: center;
}
.pagination li {
display: inline-block;
padding: 0.3em 0.6em;
}
.pagination .current {
color: #999;
}
.follow {
display: block;
text-align: right;
}
.donation ul {
list-style-type: none;
margin: 0;
}
.donation li {
padding: 0.3em;
}
.donation li a {
color: #999;
border-bottom: 3px solid #933 !important;
}
.donation li a:hover {
color: #fff;
border-bottom: 3px solid #c66 !important;
}
.webring {
padding: 2em 0 0 0;
text-align: center;
}

View file

@ -1,115 +0,0 @@
html, body {
color: #222;
background-color: #eee;
}
a {
color: #3173b4;
}
a:hover {
color: #115394;
border-bottom: 1px solid #115394;
}
code,
pre {
color: darkgreen;
background-color: #eee;
}
.codehilite .hll { background-color: #ffffcc }
.codehilite { background: #f8f8f8; }
.codehilite .c { color: #8f5902; font-style: italic } /* Comment */
.codehilite .err { color: #a40000; border: 1px solid #ef2929 } /* Error */
.codehilite .g { color: #000000 } /* Generic */
.codehilite .k { color: #204a87; font-weight: bold } /* Keyword */
.codehilite .l { color: #000000 } /* Literal */
.codehilite .n { color: #000000 } /* Name */
.codehilite .o { color: #ce5c00; font-weight: bold } /* Operator */
.codehilite .x { color: #000000 } /* Other */
.codehilite .p { color: #000000; font-weight: bold } /* Punctuation */
.codehilite .ch { color: #8f5902; font-style: italic } /* Comment.Hashbang */
.codehilite .cm { color: #8f5902; font-style: italic } /* Comment.Multiline */
.codehilite .cp { color: #8f5902; font-style: italic } /* Comment.Preproc */
.codehilite .cpf { color: #8f5902; font-style: italic } /* Comment.PreprocFile */
.codehilite .c1 { color: #8f5902; font-style: italic } /* Comment.Single */
.codehilite .cs { color: #8f5902; font-style: italic } /* Comment.Special */
.codehilite .gd { color: #a40000 } /* Generic.Deleted */
.codehilite .ge { color: #000000; font-style: italic } /* Generic.Emph */
.codehilite .gr { color: #ef2929 } /* Generic.Error */
.codehilite .gh { color: #000080; font-weight: bold } /* Generic.Heading */
.codehilite .gi { color: #00A000 } /* Generic.Inserted */
.codehilite .go { color: #000000; font-style: italic } /* Generic.Output */
.codehilite .gp { color: #8f5902 } /* Generic.Prompt */
.codehilite .gs { color: #000000; font-weight: bold } /* Generic.Strong */
.codehilite .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
.codehilite .gt { color: #a40000; font-weight: bold } /* Generic.Traceback */
.codehilite .kc { color: #204a87; font-weight: bold } /* Keyword.Constant */
.codehilite .kd { color: #204a87; font-weight: bold } /* Keyword.Declaration */
.codehilite .kn { color: #204a87; font-weight: bold } /* Keyword.Namespace */
.codehilite .kp { color: #204a87; font-weight: bold } /* Keyword.Pseudo */
.codehilite .kr { color: #204a87; font-weight: bold } /* Keyword.Reserved */
.codehilite .kt { color: #204a87; font-weight: bold } /* Keyword.Type */
.codehilite .ld { color: #000000 } /* Literal.Date */
.codehilite .m { color: #0000cf; font-weight: bold } /* Literal.Number */
.codehilite .s { color: #4e9a06 } /* Literal.String */
.codehilite .na { color: #c4a000 } /* Name.Attribute */
.codehilite .nb { color: #204a87 } /* Name.Builtin */
.codehilite .nc { color: #000000 } /* Name.Class */
.codehilite .no { color: #000000 } /* Name.Constant */
.codehilite .nd { color: #5c35cc; font-weight: bold } /* Name.Decorator */
.codehilite .ni { color: #ce5c00 } /* Name.Entity */
.codehilite .ne { color: #cc0000; font-weight: bold } /* Name.Exception */
.codehilite .nf { color: #000000 } /* Name.Function */
.codehilite .nl { color: #f57900 } /* Name.Label */
.codehilite .nn { color: #000000 } /* Name.Namespace */
.codehilite .nx { color: #000000 } /* Name.Other */
.codehilite .py { color: #000000 } /* Name.Property */
.codehilite .nt { color: #204a87; font-weight: bold } /* Name.Tag */
.codehilite .nv { color: #000000 } /* Name.Variable */
.codehilite .ow { color: #204a87; font-weight: bold } /* Operator.Word */
.codehilite .w { color: #f8f8f8; text-decoration: underline } /* Text.Whitespace */
.codehilite .mb { color: #0000cf; font-weight: bold } /* Literal.Number.Bin */
.codehilite .mf { color: #0000cf; font-weight: bold } /* Literal.Number.Float */
.codehilite .mh { color: #0000cf; font-weight: bold } /* Literal.Number.Hex */
.codehilite .mi { color: #0000cf; font-weight: bold } /* Literal.Number.Integer */
.codehilite .mo { color: #0000cf; font-weight: bold } /* Literal.Number.Oct */
.codehilite .sa { color: #4e9a06 } /* Literal.String.Affix */
.codehilite .sb { color: #4e9a06 } /* Literal.String.Backtick */
.codehilite .sc { color: #4e9a06 } /* Literal.String.Char */
.codehilite .dl { color: #4e9a06 } /* Literal.String.Delimiter */
.codehilite .sd { color: #8f5902; font-style: italic } /* Literal.String.Doc */
.codehilite .s2 { color: #4e9a06 } /* Literal.String.Double */
.codehilite .se { color: #4e9a06 } /* Literal.String.Escape */
.codehilite .sh { color: #4e9a06 } /* Literal.String.Heredoc */
.codehilite .si { color: #4e9a06 } /* Literal.String.Interpol */
.codehilite .sx { color: #4e9a06 } /* Literal.String.Other */
.codehilite .sr { color: #4e9a06 } /* Literal.String.Regex */
.codehilite .s1 { color: #4e9a06 } /* Literal.String.Single */
.codehilite .ss { color: #4e9a06 } /* Literal.String.Symbol */
.codehilite .bp { color: #3465a4 } /* Name.Builtin.Pseudo */
.codehilite .fm { color: #000000 } /* Name.Function.Magic */
.codehilite .vc { color: #000000 } /* Name.Variable.Class */
.codehilite .vg { color: #000000 } /* Name.Variable.Global */
.codehilite .vi { color: #000000 } /* Name.Variable.Instance */
.codehilite .vm { color: #000000 } /* Name.Variable.Magic */
.codehilite .il { color: #0000cf; font-weight: bold } /* Literal.Number.Integer.Long */
.donation li a {
color: #333;
border-bottom: 3px solid #933 !important;
}
.donation li a:hover {
color: #600;
border-bottom: 3px solid #600 !important;
}
.h-entry.singular h1 a {
color: #111;
}
.contrast svg {
transform: rotate(180deg);
}

View file

@ -1,26 +1,25 @@
* {
background-color: #fff !important;
color: #222;
background-color: #fff !important;
color: #222;
}
html, body {
font-size: 11pt !important;
text-shadow: unset !important;
font-family: Helvetica, sans-serif !important;
font-size: 11pt !important;
font-family: Helvetica, sans-serif !important;
}
@page {
margin: 0.6in 0.5in;
margin: 0.6in 0.5in;
}
.limit,
.content-body {
max-width: 100% !important;
margin: 0 !important;
body > section {
max-width: 100% !important;
margin: 0 !important;
}
h1, h2, h3, h4, h5, h6 {
page-break-after: avoid;
page-break-after: avoid;
}
h3,
@ -29,145 +28,55 @@ a,
.h-feed .h-entry,
code,
pre {
border: none;
border: none;
}
p, li, blockquote, figure, .footnotes {
page-break-inside: avoid !important;
page-break-inside: avoid !important;
}
a {
color: #000;
color: #000;
}
td, th {
border: 1pt solid #666;
border: 1pt solid #666;
}
.content-note,
.content-header,
.content-footer,
.footnote ol li a {
display: block;
overflow: visible;
white-space: normal;
}
body > header,
body > footer,
video,
audio,
.footnotes ol li a[href^="#"],
.footnotes ol li a[href^="#"]:after,
.exif svg,
.footnote-backref,
.donation,
.noprint {
display:none;
}
.footnotes ol li a {
display: block;
overflow: visible;
white-space: normal;
display:none !important;
}
code, pre {
max-width: 96%;
color: #222;
word-break: break-all;
word-wrap: break-word;
white-space: pre-wrap;
overflow:initial;
page-break-inside: enabled;
font-family: "Courier", "Courier New", monospace !important;
}
pre {
border: 1pt dotted #666;
padding: 0.6em;
}
.codehilite .hll { background-color: #ffffcc }
.codehilite { background: #f8f8f8; }
.codehilite .c { color: #8f5902; font-style: italic }
.codehilite .err { color: #a40000; border: 1px solid #ef2929 }
.codehilite .g { color: #000000 }
.codehilite .k { color: #204a87; font-weight: bold }
.codehilite .l { color: #000000 }
.codehilite .n { color: #000000 }
.codehilite .o { color: #ce5c00; font-weight: bold }
.codehilite .x { color: #000000 }
.codehilite .p { color: #000000; font-weight: bold }
.codehilite .ch { color: #8f5902; font-style: italic }
.codehilite .cm { color: #8f5902; font-style: italic }
.codehilite .cp { color: #8f5902; font-style: italic }
.codehilite .cpf { color: #8f5902; font-style: italic }
.codehilite .c1 { color: #8f5902; font-style: italic }
.codehilite .cs { color: #8f5902; font-style: italic }
.codehilite .gd { color: #a40000 }
.codehilite .ge { color: #000000; font-style: italic }
.codehilite .gr { color: #ef2929 }
.codehilite .gh { color: #000080; font-weight: bold }
.codehilite .gi { color: #00A000 }
.codehilite .go { color: #000000; font-style: italic }
.codehilite .gp { color: #8f5902 }
.codehilite .gs { color: #000000; font-weight: bold }
.codehilite .gu { color: #800080; font-weight: bold }
.codehilite .gt { color: #a40000; font-weight: bold }
.codehilite .kc { color: #204a87; font-weight: bold }
.codehilite .kd { color: #204a87; font-weight: bold }
.codehilite .kn { color: #204a87; font-weight: bold }
.codehilite .kp { color: #204a87; font-weight: bold }
.codehilite .kr { color: #204a87; font-weight: bold }
.codehilite .kt { color: #204a87; font-weight: bold }
.codehilite .ld { color: #000000 }
.codehilite .m { color: #0000cf; font-weight: bold }
.codehilite .s { color: #4e9a06 }
.codehilite .na { color: #c4a000 }
.codehilite .nb { color: #204a87 }
.codehilite .nc { color: #000000 }
.codehilite .no { color: #000000 }
.codehilite .nd { color: #5c35cc; font-weight: bold }
.codehilite .ni { color: #ce5c00 }
.codehilite .ne { color: #cc0000; font-weight: bold }
.codehilite .nf { color: #000000 }
.codehilite .nl { color: #f57900 }
.codehilite .nn { color: #000000 }
.codehilite .nx { color: #000000 }
.codehilite .py { color: #000000 }
.codehilite .nt { color: #204a87; font-weight: bold }
.codehilite .nv { color: #000000 }
.codehilite .ow { color: #204a87; font-weight: bold }
.codehilite .w { color: #f8f8f8; text-decoration: underline }
.codehilite .mb { color: #0000cf; font-weight: bold }
.codehilite .mf { color: #0000cf; font-weight: bold }
.codehilite .mh { color: #0000cf; font-weight: bold }
.codehilite .mi { color: #0000cf; font-weight: bold }
.codehilite .mo { color: #0000cf; font-weight: bold }
.codehilite .sa { color: #4e9a06 }
.codehilite .sb { color: #4e9a06 }
.codehilite .sc { color: #4e9a06 }
.codehilite .dl { color: #4e9a06 }
.codehilite .sd { color: #8f5902; font-style: italic }
.codehilite .s2 { color: #4e9a06 }
.codehilite .se { color: #4e9a06 }
.codehilite .sh { color: #4e9a06 }
.codehilite .si { color: #4e9a06 }
.codehilite .sx { color: #4e9a06 }
.codehilite .sr { color: #4e9a06 }
.codehilite .s1 { color: #4e9a06 }
.codehilite .ss { color: #4e9a06 }
.codehilite .bp { color: #3465a4 }
.codehilite .fm { color: #000000 }
.codehilite .vc { color: #000000 }
.codehilite .vg { color: #000000 }
.codehilite .vi { color: #000000 }
.codehilite .vm { color: #000000 }
.codehilite .il { color: #0000cf; font-weight: bold }
figcaption {
font-size: 0.9em;
border: 1pt dotted #666;
padding: 0.6em;
}
.adaptimg {
max-height: 35vh;
max-width: 90vw;
outline: none;
border: 1px solid #000;
max-height: 35vh;
max-width: 90vw;
outline: none;
border: 1px solid #000;
}
.h-feed .h-entry {
page-break-after:always;
page-break-after:always;
}

337
templates/style.css Normal file
View file

@ -0,0 +1,337 @@
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
transition: all 0.2s;
}
html {
background-color: #111;
color: #bbb;
}
body {
margin: 0;
padding: 0;
font-family: "Liberation Sans", sans-serif;
color: #ccc;
background-color: #222;
font-size: 110%;
line-height: 1.3em;
}
svg {
transform: rotate(0deg);
width: 16px;
height: 16px;
fill: currentColor;
vertical-align: text-top;
}
a {
color: #5193D4;
text-decoration: none;
}
a:hover {
color: #fff;
}
h1 {
font-size: 1.6em;
}
h2, h3 {
margin-top: 2em;
}
hr {
border: none;
border-top: 1px solid #777;
margin: 1em 0;
clear:both;
}
blockquote {
border-left: 3px solid #999;
margin: 2em 0 2em 1em;
padding: 0 0 0 1em;
color: #aaa;
}
dt {
font-weight: bold;
margin: 1em 0 0.6em 0;
}
dd img {
width: 1em;
height: auto;
}
figure {
margin: 2em 0;
}
figure > a {
border: none;
}
figcaption {
padding: 0.3em 0;
text-align: center;
}
figure img {
display: block;
max-height: 98vh;
max-width: 100%;
width:auto;
height:auto;
margin: 0 auto;
border: 1px solid #000;
}
figcaption dt {
display: none;
}
figcaption dd {
font-size: 0.8em;
display: inline-block;
margin:0.3em 0.3em;
}
ul {
padding-left: 1.3em;
}
li {
padding: 0.1em 0;
}
li p {
margin: 0;
}
input {
border: none;
border-bottom: 3px solid #ccc;
color: #ccc;
background-color: transparent;
}
label {
display: none;
}
nav ul {
list-style-type: none;
margin: 0;
padding: 0;
}
nav li {
display: inline-block;
padding: 0 0.6em 0 0;
}
code, pre, q, figcaption {
font-family: "Courier New", "Courier", monospace;
font-size: 0.8em;
}
code, pre {
color: limegreen;
border: 1px solid #666;
direction: ltr;
word-break: break-all;
word-wrap: break-word;
white-space: pre-wrap;
overflow:initial;
}
pre {
padding: 0.6em;
}
code {
padding: 0.1em 0.2em;
}
pre > code {
border: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
width: 100%;
}
td,
th {
padding: 0.3em;
border: 1px solid #777;
text-align:left;
}
th {
font-weight: bold;
background-color: rgba(0, 0, 0, .1);
}
tr:nth-child(odd) {
}
tr:nth-child(even) {
background-color: rgba(0, 0, 0, .1);
}
body > header,
body > footer {
text-align: center;
padding: 0.6em 0.3em;
background-color: #111;
}
body > header form {
padding: 0.2em 0 0 0;
}
body > header {
padding-right: 3em;
}
body > svg,
body > script {
display: none;
}
body > header nav {
margin: 0.3em 0;
}
body > header nav li a {
font-weight: bold;
color: #ccc;
border-bottom: 3px solid transparent;
text-decoration: none;
padding-bottom: 0.3em;
}
body > header a:hover,
body > header a.active,
input:active,
input:hover {
border-bottom: 3px solid #fefefe;
color: #fefefe;
}
body > header a svg {
display: block;
margin: 0.1em auto;
}
.limit,
body > section {
max-width: 86ch;
margin: 0 auto;
padding: 0.6em;
}
body > nav {
margin: 2em 0 1em 0;
font-size: 1.4em;
}
body > nav ul {
text-align: center;
}
body > nav li {
margin: 0.3em 0.6em;
}
body > nav .current {
color: #999;
}
body > footer {
text-align: left;
color: #ccc;
}
body > footer img {
width: 1em;
}
body > footer h2 {
display: none;
}
body > footer dt {
font-weight: bold;
margin: 1em 0 0 0;
}
body > footer dd {
margin: -1.3em 0 0 4em;
}
body > footer nav {
display: flex;
justify-content: space-between;
}
.webring {
text-align: center;
}
.footnote a {
display: inline-block;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
vertical-align: top;
max-width: 80%;
}
.footnote-ref {
margin: 0 0 0 0.1em;
}
.contrast,
.follow {
position: fixed;
right: 1em;
}
.contrast {
top: 0.1em;
}
.follow {
top: 3em;
}
.h-feed h1 {
display: none;
}
@media all and (min-width: 56em) {
body > header {
text-align: unset;
display: flex;
justify-content: space-between;
}
body > header li svg {
display: inline-block;
}
body > header form {
margin: 0;
}
}