support for checkbox-lists + new h4 = paragraph, old h4 -> h5

This commit is contained in:
relikd
2021-10-21 16:40:54 +02:00
parent bcb2b662a5
commit f0cbf214b9
7 changed files with 38 additions and 13 deletions

View File

@@ -37,8 +37,8 @@ The format is mostly markdown, except for these modifications:
- multi-line content allowed. - multi-line content allowed.
- the prefix `@=latex=` will display its content in pdf only. There is no html-prefix equivalent. - the prefix `@=latex=` will display its content in pdf only. There is no html-prefix equivalent.
- Use `####` to create paragraph like sections. These sections are displayed in the margin. Like an index for quick reference. In mobile html they are normal `h4` headings. - Use `####` to create paragraphs and `#####` for paragraph-like sections. The latter are displayed in the margin. Like an index for quick reference. In mobile html they are normal `h5` headings.
- Of course `#`, `##`, and `###` are translated to `h1` to `h3` headings - Of course `#`, `##`, and `###` translate to `h1` to `h3` headings.
- You can add a reference-id to a title by adding `{#label}` after the title, e.g., `## Title {#title}` - You can add a reference-id to a title by adding `{#label}` after the title, e.g., `## Title {#title}`
- other than that, all titles have implicit labels where spaces are replaced with dashes `My Title` becomes `my-title` - other than that, all titles have implicit labels where spaces are replaced with dashes `My Title` becomes `my-title`

View File

@@ -1,6 +1,7 @@
@font-face { font-family: 'Roboto'; src: url(fonts/Roboto-Regular.otf); } /* only h1-6, thus no italic */ @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'; src: url(fonts/Piazzolla.ttf); }
@font-face { font-family: 'Piazzolla'; font-style: italic; src: url(fonts/Piazzolla-Italic.ttf); } @font-face { font-family: 'Piazzolla'; font-style: italic; src: url(fonts/Piazzolla-Italic.ttf); }
@font-face { font-family: 'Iosevka'; src: url(fonts/iosevka-ss04-regular.ttf); }
body { body {
font-family: Piazzolla, Helvetica Neue, sans-serif; font-family: Piazzolla, Helvetica Neue, sans-serif;
@@ -10,6 +11,11 @@ b,strong { font-weight: 600; }
h1,h2,h3,h4,h5,h6,.topnav { h1,h2,h3,h4,h5,h6,.topnav {
font-family: Roboto, Helvetica Neue, sans-serif; font-family: Roboto, Helvetica Neue, sans-serif;
} }
pre, pre > code {
margin-left: 0.1em;
font-family: Iosevka, Menlo, Consolas, Courier, monospace;
font-size: 1rem;
}
#subtitle { margin-top: inherit; } #subtitle { margin-top: inherit; }
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
body { background: #17110E; color: #DDD; font-weight: 500; } body { background: #17110E; color: #DDD; font-weight: 500; }
@@ -68,23 +74,28 @@ div.topnav {
} }
/* Margin-Sections */ /* Margin-Sections */
p + .h4-spacer { p + .h5-spacer {
margin-top: 2.2rem; margin-top: 2.2rem;
} }
h4 { h4,h5 {
display: none;
font-size: 1.4em; font-size: 1.4em;
margin-bottom: 1rem; margin-bottom: 1rem;
} }
h4 + p { margin-top: 0; } h4 + p, h5 + p { margin-top: 0; }
h5 { display: none; }
@media (max-width: 760px) { @media (max-width: 760px) {
.h4-spacer { display: none; } .h5-spacer { display: none; }
h4 { display: inherit; } h5 { display: inherit; }
h4 + p>.marginnote, h4 + p>.sidenote { h5 + p>.marginnote, h5 + p>.sidenote {
display: none; display: none;
} }
} }
/* Support for Checkbox-Lists */
input[type='checkbox'] { width: 1.4em; height: 1.4em; margin: 0 .5em 0 0; }
li.checkbox { text-indent: -1.4em; }
li.checkbox::marker { content: ''; }
/* Override original Tufte CSS */ /* Override original Tufte CSS */
p { p {

View File

@@ -15,6 +15,7 @@
\usepackage{url} \usepackage{url}
\usepackage{graphicx} \usepackage{graphicx}
\usepackage{microtype} \usepackage{microtype}
\usepackage{mathabx}
\setmainfont[ \setmainfont[
Path = fonts/, Path = fonts/,
@@ -31,6 +32,7 @@
]{Roboto-Regular} ]{Roboto-Regular}
\setmonofont[ \setmonofont[
Path = fonts/, Path = fonts/,
Scale = 0.8,
BoldFont = {iosevka-ss04-bold}, BoldFont = {iosevka-ss04-bold},
ItalicFont = {iosevka-ss04-italic}, ItalicFont = {iosevka-ss04-italic},
BoldItalicFont = {iosevka-ss04-bolditalic} BoldItalicFont = {iosevka-ss04-bolditalic}
@@ -61,6 +63,8 @@
\renewcommand\allcapsspacing[1]{{\addfontfeature{LetterSpace=15}#1}} \renewcommand\allcapsspacing[1]{{\addfontfeature{LetterSpace=15}#1}}
\renewcommand\smallcapsspacing[1]{{\addfontfeature{LetterSpace=10}#1}} \renewcommand\smallcapsspacing[1]{{\addfontfeature{LetterSpace=10}#1}}
\renewcommand\subsubsection\paragraph
\newcommand{\marginsection}[1]{ \newcommand{\marginsection}[1]{
\if@noskipsec\leavevmode\fi \par \if@noskipsec\leavevmode\fi \par
\paragraph{} \paragraph{}

View File

@@ -1,3 +1,7 @@
# Sectioning # Sectioning
s?<h2?</section><section><h2?g s?<h2?</section><section><h2?g
s?</section><section><h2 class="no-sect"?<h2?g s?</section><section><h2 class="no-sect"?<h2?g
# TODO: define good option to toggle between non-/editable checkboxes
#s?<li><input type="checkbox" disabled=""?<li><input type="checkbox"?g
s?<li><input type="checkbox"?<li class="checkbox"><input type="checkbox"?g

View File

@@ -3,8 +3,8 @@ s?\\,?<span style="white-space:nowrap">\&thinsp;</span>?g
s?\\~?\&nbsp;?g s?\\~?\&nbsp;?g
# Margin note # Margin note
s?####[[:space:]]*\(.*\)$?<p class="h4-spacer"></p>\ s?#####[[:space:]]*\(.*\)$?<p class="h5-spacer"></p>\
#### \1\ ##### \1\
@== \1 ==@?g @== \1 ==@?g
# Use this to show margin notes inline # Use this to show margin notes inline

View File

@@ -2,4 +2,10 @@
s?@=\(latex\)\{0,1\}=[[:space:]]*?\\marginnote{?g s?@=\(latex\)\{0,1\}=[[:space:]]*?\\marginnote{?g
s?[[:space:]]*==@?}?g s?[[:space:]]*==@?}?g
# scale images # scale images
s?\\marginnote{\\includegraphics?\\marginnote{\\includegraphics[width=1\\linewidth]?g s?\\marginnote{\\includegraphics?\\marginnote{\\includegraphics\[width=1\\linewidth\]?g
# For proper clickable check boxes we need to increment the name ids :-/
#s?\\item\[\$\\square\$\]?\\item\[\\CheckBox{}\]?g
#s?\\item\[\$\\boxtimes\$\]?\\item\[\\CheckBox\[checked\]{}\]?g
# OR
s?\\item\[\$\\square\$\]?\\item\[\$\\Box\$\]?g

View File

@@ -6,4 +6,4 @@ s?<dt>?\\item[?g
s?</dt>?] ?g s?</dt>?] ?g
s?<dd>??g s?<dd>??g
s?</dd>??g s?</dd>??g
s?####[[:space:]]*\(.*\)$?\\marginsection{\1}?g s?#####[[:space:]]*\(.*\)$?\\marginsection{\1}?g