numbered headers for paper-prints

This commit is contained in:
ed 2020-05-17 00:33:34 +02:00
parent 583da3d4a9
commit 2f1baf17d4
4 changed files with 82 additions and 9 deletions

View file

@ -19,6 +19,8 @@ turn your phone or raspi into a portable file server with resumable uploads/down
* Android-Chrome: set max "parallel uploads" for 200% upload speed (android bug)
* Android-Firefox: takes a while to select files (in order to avoid the above android-chrome issue)
* Desktop-Firefox: may use gigabytes of RAM if your connection is great and your files are massive
* paper-printing is affected by dark/light-mode! use lightmode for color, darkmode for grayscale
* because no browsers currently implement the media-query to do this properly orz
## status

View file

@ -438,7 +438,7 @@ blink {
width: .8em;
}
html.dark #toc::-webkit-scrollbar-thumb {
background: #eb0;
background: #b80;
}
html.dark #mn.undocked {
box-shadow: 0 0 .5em #555;
@ -454,9 +454,9 @@ blink {
@page {
size: A4;
padding: 0;
margin: .5in .2in;
mso-header-margin: .2in;
mso-footer-margin: .2in;
margin: .5in .6in;
mso-header-margin: .6in;
mso-footer-margin: .6in;
mso-paper-source: 0;
}
a {
@ -467,7 +467,6 @@ blink {
}
#toc>ul {
border-left: .1em solid #84c4dd;
text-decoration: underline;
}
#mn, #mh {
display: none;
@ -480,12 +479,38 @@ blink {
#toc {
margin-left: 1em !important;
}
pre code::before {
color: #058;
#toc a {
color: #000 !important;
}
#toc a::after {
/* hopefully supported by browsers eventually */
content: leader('.') target-counter(attr(href), page);
}
a[ctr]::before {
content: attr(ctr) '. ';
}
h1 {
margin: 2em 0;
}
h2 {
margin: 2em 0 0 0;
}
h1, h2, h3 {
page-break-inside: avoid;
}
h1::after,
h2::after,
h3::after {
content: 'orz';
color: transparent;
display: block;
line-height: 1em;
padding: 4em 0 0 0;
margin: 0 0 -5em 0;
}
p {
page-break-inside: avoid;
}
table {
page-break-inside: auto;
}
@ -502,7 +527,33 @@ blink {
#mp a.vis::after {
content: ' (' attr(href) ')';
border-bottom: 1px solid #bbb;
color: #777;
color: #444;
}
blockquote {
border-color: #555;
}
code {
border-color: #bbb;
}
pre, pre code {
border-color: #999;
}
pre code::before {
color: #058;
}
html.dark a {
color: #000;
}
html.dark pre,
html.dark code {
color: #240;
}
html.dark p>em,
html.dark li>em {
color: #940;
}
}

View file

@ -41,7 +41,7 @@ function static(obj) {
if (ua.indexOf(') Gecko/') !== -1 && ua.indexOf('Linux') !== -1) {
// necessary on ff-68.7 at least
var s = document.createElement('style');
s.innerHTML = '@page { margin: .6in .2in .8in .2in; }';
s.innerHTML = '@page { margin: .5in .6in .8in .6in; }';
console.log(s.innerHTML);
document.head.appendChild(s);
}
@ -254,6 +254,7 @@ function init_toc() {
var anchor = null; // current toc node
var html = []; // generated toc html
var lv = 0; // current indentation level in the toc html
var ctr = [0, 0, 0, 0, 0, 0];
var manip_nodes_dyn = dom_pre.getElementsByTagName('*');
var manip_nodes = [];
@ -274,6 +275,11 @@ function init_toc() {
html.push('</ul>');
lv--;
}
ctr[lv - 1]++;
for (var b = lv; b < 6; b++)
ctr[b] = 0;
elm.childNodes[0].setAttribute('ctr', ctr.slice(0, lv).join('.'));
html.push('<li>' + elm.innerHTML + '</li>');

View file

@ -99,3 +99,17 @@ Range: bytes=24- "yz" Content-Range: bytes 24-25/26
Range: bytes=25-29 "z" Content-Range: bytes 25-25/26
Range: bytes=26- Content-Range: bytes */26
HTTP/1.1 416 Requested Range Not Satisfiable
##
## md perf
var tsh = [];
function convert_markdown(md_text, dest_dom) {
tsh.push(new Date().getTime());
while (tsh.length > 10)
tsh.shift();
if (tsh.length > 1) {
var end = tsh.slice(-2);
console.log("render", end.pop() - end.pop(), (tsh[tsh.length - 1] - tsh[0]) / (tsh.length - 1));
}