Update to readable.css v1.1.0 (#13)

* Update to readable.css v1.1.0

data-style="classy" was also added to the <nav> element to preserve the
same style as the previous default.

* Use minified version of readable.css to save bandwidth

The readable.css file is kept for readability sake of people using this
template.

---------

Co-authored-by: Benjamin Hollon <me@benjaminhollon.com>
This commit is contained in:
Benjamin Hollon 2023-05-02 16:15:28 -05:00 committed by GitHub
parent bcd26f888b
commit f3327bc67c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 52 additions and 20 deletions

View File

@ -1,7 +1,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- This ensures your site looks right on mobile devices -->
<link rel="stylesheet" type="text/css" href="/css/readable.css?v=1.0.1">
<link rel="stylesheet" type="text/css" href="/css/readable.min.css?v=1.1.0">
<meta name="description" content='{{ .Page.Description }}'>
{{ if .Site.Params.favicon }}
<link rel="shortcut icon" href="{{ relURL ($.Site.Params.favicon) }}" type="image/x-icon" /> <!-- Show a favicon for your site, if one is configured in the Params section of the config. -->

View File

@ -1,10 +1,10 @@
<h1>{{ $.Site.Title }}</h1>
<p>{{ $.Site.Params.subtitle }}</p>
<nav>
<nav data-style="classy">
{{ range .Site.Menus.main -}}
<span>
<a href="{{ .URL | absLangURL }}">{{ .Name }}</a>
</span>
{{- end }}
</nav>
</nav>

View File

@ -1,4 +1,4 @@
/* readable.css 1.0.1-beta */
/* readable.css 1.1.0, licensed 0BSD */
/* Font family support */
html, html[data-font-family="serif"] {
@ -21,7 +21,7 @@ html[data-high-contrast="on"], html[data-theme="light"][data-high-contrast="on"]
}
html[data-theme="dark"] {
--background-color: #222830;
--background-color: #1f272d;
--color: #fff;
}
html[data-theme="dark"][data-high-contrast="on"] {
@ -101,12 +101,12 @@ figure:not(.exclude) {
text-align: center;
}
figure:not(.exclude) > * ~ figcaption {
figure:not(.exclude) > * + figcaption {
margin-top: 0;
font-style: italic;
}
article > aside:not(.exclude) {
article aside:not(.exclude) {
border: var(--line-width) solid;
padding: 0 var(--one-line);
border-radius: var(--half-line);
@ -128,7 +128,7 @@ p, ul, ol, figcaption, nav, td, th, label {
line-height: var(--line-height);
}
h1, h2, h3, h4, h5, h6, p, blockquote, hr, footer, header, nav, figure, figcaption, ul, ol, :is(body, article, main) > :is(img, video):not(.exclude), table, article > aside, article > aside {
h1, h2, h3, h4, h5, h6, p, blockquote, hr, footer, header, nav, figure, figcaption, :is(ul, ol):not(li > *), :is(body, article, main) > :is(img, video, details):not(.exclude), table, article > aside, article > aside {
margin: var(--one-line) 0;
}
@ -156,35 +156,61 @@ h3, h4, h5, h6 {
margin-bottom: calc(var(--line-height) * 0.25rem);
}
:is(h3, h4, h5, h6) ~ * {
:is(h3, h4, h5, h6) + * {
margin-top: 0;
}
/* Navbar */
:is(body, header) > nav:first-of-type:not(.exclude) { /* This styling only affects the first nav element that is the direct child of the body */
nav:not(.exclude:not([data-style]), [data-style="none"]) { /* This styling only affects the first nav element that is the direct child of the body */
text-align: center;
border-width: var(--line-width) 0;
border-style: solid;
line-height: var(--line-height);
padding: calc((var(--line-height) * 0.5rem) - var(--line-width)); /* Put half a line's height on both top and bottom, then remove the width of the border */
display: flex;
flex-flow: row wrap;
}
:is(body, header) > nav:first-of-type:not(.exclude) > * {
nav:not(.exclude:not([data-style]), [data-style="none"]) > * {
flex-grow: 1;
margin: 0 var(--half-line);
margin: calc((var(--line-height) * 0.5rem) - var(--line-width)) var(--half-line); /* Put half a line's height on both top and bottom, then remove the width of the border */
text-transform: uppercase;
}
nav[data-style="blockout"],
nav:is([data-style="boxes"], [data-style="roundesque"]) a:is(:hover, :focus) {
background-color: var(--color);
color: var(--background-color);
}
nav[data-style="blockout"] a {
text-decoration: none;
}
nav[data-style="blockout"] a:is(:hover, :focus) {
background-color: var(--background-color);
color: var(--color);
}
nav[data-style]:is([data-style="boxes"], [data-style="roundesque"]) {
border: 0;
}
nav:is([data-style="boxes"], [data-style="roundesque"]) a {
text-decoration: none;
border: var(--line-width) solid;
}
nav[data-style="roundesque"] a {
border-radius: calc(0.25 * var(--one-line));
}
@media (prefers-reduced-motion: no-preference) {
:is(body, header) > nav:first-of-type:not(.exclude) a {
nav[data-style="classy"] span > a {
text-decoration: none;
display: inline-block;
}
:is(body, header) > nav:first-of-type:not(.exclude) a::after {
nav[data-style="classy"] span > a::after {
content: '';
width: 0;
height: var(--line-width);
@ -193,7 +219,7 @@ h3, h4, h5, h6 {
transition: 150ms;
}
:is(body, header) > nav:first-of-type:not(.exclude) a:is(:hover, :focus)::after {
nav[data-style="classy"] span > a:is(:hover, :focus)::after {
width: 100%;
}
}
@ -235,12 +261,12 @@ form {
max-width: var(--form-width)
}
form:not(.exclude) :is(label:not(input:is([type="checkbox"], [type="radio"]) ~ label), input:not([type="checkbox"], [type="radio"]), textarea, select) {
form:not(.exclude) :is(label:not(input:is([type="checkbox"], [type="radio"]) + label), input:not([type="checkbox"], [type="radio"]), textarea, select) {
display: block;
margin: var(--half-line) 0;
}
form:not(.exclude) :is(input:not([type="checkbox"], [type="radio"]), textarea, select) {
form:not(.exclude) :is(input:not([type="checkbox"], [type="radio"]), textarea, select), button {
box-sizing: border-box;
padding: var(--half-line);
background: transparent;
@ -250,6 +276,10 @@ form:not(.exclude) :is(input:not([type="checkbox"], [type="radio"]), textarea, s
width: 100%;
}
form:not(.exclude) label:not(input:is([type="checkbox"], [type="radio"]) ~ label) {
button {
width: initial;
}
form:not(.exclude) label:not(input:is([type="checkbox"], [type="radio"]) + label) {
font-weight: bold;
}

2
static/css/readable.min.css vendored Normal file
View File

@ -0,0 +1,2 @@
/* readable.css v1.1.0, licensed 0BSD */
html,html[data-font-family="serif"]{--font-family:serif}html[data-font-family="sans-serif"]{--font-family:sans-serif}html[data-font-family="monospace"]{--font-family:monospace}html,html[data-theme="light"]{--background-color:snow;--color:#000}html[data-high-contrast="on"],html[data-theme="light"][data-high-contrast="on"]{--background-color:#fff}html[data-theme="dark"]{--background-color:#1f272d;--color:#fff}html[data-theme="dark"][data-high-contrast="on"]{--background-color:#000}@media (prefers-color-scheme:dark){html{--background-color:#222830;--color:#fff}html[data-high-contrast="on"]{--background-color:#000}}@media (prefers-contrast:more){:is(html,html[data-theme="light"]):not([data-high-contrast="off"]){--background-color:#fff}html[data-theme="dark"]:not([data-high-contrast="off"]){--background-color:#000}}:root{--column-width:67ch;--form-width:50ch;--line-width:.125rem;--line-height:1.5;--one-line:calc(var(--line-height) * 1rem);--half-line:calc(var(--one-line) * 0.5);font-family:var(--font-family);background-color:var(--background-color);color:var(--color)}a{color:inherit}a:active{color:red}header,footer,h1,h2{text-align:center}footer:not(.exclude){border-top:var(--line-width) solid}summary{cursor:pointer}blockquote:not(.exclude){padding-left:var(--one-line);border-left:var(--line-width) solid}ul,ol{padding-left:calc(var(--line-height) * 2rem)}:is(body,article,main,figure)>:is(img,video):not(.exclude){max-width:100%}figure:not(.exclude){text-align:center}figure:not(.exclude)>*+figcaption{margin-top:0;font-style:italic}article aside:not(.exclude){border:var(--line-width) solid;padding:0 var(--one-line);border-radius:var(--half-line)}pre{max-width:100%;overflow:auto}hr{color:inherit;border:0;border-top:var(--line-width) solid}p,ul,ol,figcaption,nav,td,th,label{line-height:var(--line-height)}h1,h2,h3,h4,h5,h6,p,blockquote,hr,footer,header,nav,figure,figcaption,:is(ul,ol):not(li>*),:is(body,article,main)>:is(img,video,details):not(.exclude),table,article>aside,article>aside{margin:var(--one-line) 0}header h1{font-weight:400}h1,h2{line-height:calc(var(--line-height) * 2rem)}h1{font-size:2.5rem}h2{font-size:1.75rem}h3,h4,h5,h6{line-height:var(--one-line);padding-top:calc(var(--line-height) * 0.75rem);margin-bottom:calc(var(--line-height) * 0.25rem)}:is(h3,h4,h5,h6)+*{margin-top:0}nav:not(.exclude:not([data-style]),[data-style="none"]){text-align:center;border-width:var(--line-width) 0;border-style:solid;line-height:var(--line-height);display:flex;flex-flow:row wrap}nav:not(.exclude:not([data-style]),[data-style="none"])>*{flex-grow:1;margin:calc((var(--line-height) * 0.5rem) - var(--line-width)) var(--half-line);text-transform:uppercase}nav[data-style="blockout"],nav:is([data-style="boxes"],[data-style="roundesque"]) a:is(:hover,:focus){background-color:var(--color);color:var(--background-color)}nav[data-style="blockout"] a{text-decoration:none}nav[data-style="blockout"] a:is(:hover,:focus){background-color:var(--background-color);color:var(--color)}nav[data-style]:is([data-style="boxes"],[data-style="roundesque"]){border:0}nav:is([data-style="boxes"],[data-style="roundesque"]) a{text-decoration:none;border:var(--line-width) solid}nav[data-style="roundesque"] a{border-radius:calc(0.25 * var(--one-line))}@media (prefers-reduced-motion:no-preference){nav[data-style="classy"] span>a{text-decoration:none;display:inline-block}nav[data-style="classy"] span>a::after{content:'';width:0;height:var(--line-width);display:block;background:var(--color);transition:150ms}nav[data-style="classy"] span>a:is(:hover,:focus)::after{width:100%}}body{margin:0 auto;width:min(95%,var(--column-width))}@media (min-width:70.5ch){[data-justify="on"] body{text-align:justify;text-justify:inter-character}}table:not(.exclude){display:block;width:100%;overflow:auto;border-collapse:collapse}table:not(.exclude) :is(td,th){padding:calc(var(--line-height) * 0.25rem);border:var(--line-width) solid}table:not(.exclude) td{word-wrap:break-word}form{max-width:var(--form-width)}form:not(.exclude) :is(label:not(input:is([type="checkbox"],[type="radio"])+label),input:not([type="checkbox"],[type="radio"]),textarea,select){display:block;margin:var(--half-line) 0}form:not(.exclude) :is(input:not([type="checkbox"],[type="radio"]),textarea,select),button{box-sizing:border-box;padding:var(--half-line);background:transparent;border:var(--line-width) solid;color:inherit;font:inherit;width:100%}button{width:initial}form:not(.exclude) label:not(input:is([type="checkbox"],[type="radio"])+label){font-weight:700}