add support for ####-paragraphs and dark mode

This commit is contained in:
relikd
2021-09-10 12:02:08 +02:00
parent 63fdf7535a
commit bcb2b662a5
20 changed files with 330 additions and 160 deletions

109
bin/custom.css Normal file → Executable file
View File

@@ -1,43 +1,89 @@
.button {
border: 2px solid #ff5050;
color: #ff5050;
background-color: #fff;
padding: 16px 32px;
font-size: 16px;
font-weight: bold;
margin: 4px 2px;
cursor: pointer;
}
.button:hover {
color: #fff;
background-color: #ff5050;
@font-face { font-family: 'Roboto'; src: url(fonts/Roboto-Regular.otf); } /* only h1-6, thus no italic */
@font-face { font-family: 'Piazzolla'; src: url(fonts/Piazzolla.ttf); }
@font-face { font-family: 'Piazzolla'; font-style: italic; src: url(fonts/Piazzolla-Italic.ttf); }
body {
font-family: Piazzolla, Helvetica Neue, sans-serif;
font-weight: 400;
}
b,strong { font-weight: 600; }
h1,h2,h3,h4,h5,h6,.topnav {
font-family: Roboto, Helvetica Neue, sans-serif;
}
#subtitle { margin-top: inherit; }
@media (prefers-color-scheme: dark) {
body { background: #17110E; color: #DDD; font-weight: 500; }
b, strong { font-weight: 600; color: #FFF; }
}
/* Quick-jump to section navigation */
div.topnav {
position: sticky;
top: 0;
color:grey;
z-index: 1;
background-color: white;
overflow: hidden;
width: max-content;
max-width: 100%;
}
.topnav a {
float: left;
color:grey;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 16px;
display: block;
}
.topnav a:hover {
background-color: whitesmoke;
color: black;
}
@media (prefers-color-scheme: dark) {
div.topnav { background-color: #372F2C; color: #DDD; }
}
/* Back-to-top button */
.button {
border: 2px solid #ff5050;
color: #ff5050;
background-color: #ffffff;
align-self: baseline;
padding: 16px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
font-weight: bold;
margin: 4px 2px;
transition-duration: 0.4s;
cursor: pointer;
position: fixed;
bottom: 1em;
}
.button:hover {
color: #ffffff;
transition-timing-function: ease-in;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
background-color: #ff5050;
}
/* Margin-Sections */
p + .h4-spacer {
margin-top: 2.2rem;
}
h4 {
display: none;
font-size: 1.4em;
margin-bottom: 1rem;
}
h4 + p { margin-top: 0; }
@media (max-width: 760px) {
.h4-spacer { display: none; }
h4 { display: inherit; }
h4 + p>.marginnote, h4 + p>.sidenote {
display: none;
}
}
/* Override original Tufte CSS */
@@ -47,15 +93,32 @@ p {
-ms-hyphens: auto;
}
h2, h3 {
h3 { line-height: inherit; }
h2, h3, h4 {
font-style: unset;
margin-top: 2.5rem;
}
a:link, .tufte-underline, .hover-tufte-underline:hover {
/*background: unset;*/
text-shadow: unset;
}
/*
You can choose between two modes.
The former will display all margin notes in-text.
The latter will add a toggle button.
*/
@media (max-width: 760px) {
.sidenote, .marginnote {
/* for now, until toggle works */
display: block;
width: 90%;
margin: 2rem 5%;
margin: 1rem 5%;
}
}
}
/*
label.mtoggle::before { content: unset; }
@media (max-width: 760px) {
label.mtoggle::before { content: ' ⊕'; }
}*/

View File

@@ -3,7 +3,7 @@
<head>
<title>md2tufte</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="tufte.css"/>
<link rel="stylesheet" href="custom.css"/>
</head>
@@ -22,12 +22,12 @@
<article>
<section>
<h1 id="title">md2tufte</h1>
<h2>Exemplary overview document</h2>
<p><em>relikd</em> (v20210704)</p>
<h2 id="subtitle">Exemplary overview document &nbsp;·&nbsp; v2021-09-10</h2>
<p><em id="author">relikd</em></p>
<p>This document is an exemplary usage of this tool. Of course it will look better with actual documents when the content is longer and the lines break more nicely.</p>
</section><section><h2 id="features">Features</h2>
<p>This document was created with <a href="https://github.com/relikd/md2tufte"><code>md2tufte</code></a> a tool which takes a markdown file as input and returns html and pdf as output. It supports the usual markdown syntax and is augmented with a substitution header. To place something in the margin, use the <code>@ ==</code> syntax.</p>
<p>For further examples, refer to the README file. You can use in-document references.<span class="marginnote">e.<span style="white-space:nowrap"></span>g., see section <a href="#requirements">Requirements</a>. </span></p>
<p>This document<span style="display: none"> A HTML version of this document using a responsive layout for small screens is available at <a href="https://relikd.github.io/md2tufte/bin/en-example.html">https://relikd.github.io/md2tufte/bin/en-example.html</a> </span> was created with <a href="https://github.com/relikd/md2tufte"><code>md2tufte</code></a> a tool which takes a markdown file as input and returns html and pdf as output. It supports the usual markdown syntax and is augmented with a substitution header. To place something in the margin, use the <code>@ ==</code> syntax.<span class="marginnote"> <a href="multi-line-url">multi line, super long name desc with various other words than these mere few you saw in the beginning!</a> </span></p>
<p>For further examples, refer to the README file. You can use in-document references.<span class="marginnote"> e.<span style="white-space:nowrap"></span>g., see section <a href="#requirements">Requirements</a>. </span></p>
<p>As you see, you can put about anything in the margin. If you want to control that something should be only visible in the pdf version of the document but not in the html version, use the <code>@ =latex=</code> syntax. Currently there is no inverse, i.<span style="white-space:nowrap"></span>e., <code>@ =html=</code> will <strong>not</strong> work.</p>
</section><section><h2 id="requirements">Requirements</h2>
<p><span class="marginnote"><img src="img/example.png" /> You can use margin images!</span></p>
@@ -69,3 +69,4 @@ build the intermediate file only.
<button class="button" onclick="window.scrollTo({top: 0, behavior: 'smooth'})">back to top</button>
</body>
</html>

93
bin/fonts/LICENSE-Piazzolla.txt Executable file
View File

@@ -0,0 +1,93 @@
Copyright 2018 The Piazzolla Project Authors (https://github.com/huertatipografica/piazzolla)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Binary file not shown.

BIN
bin/fonts/Piazzolla.ttf Normal file

Binary file not shown.

Binary file not shown.