Skip to content

Commit df130ee

Browse files
authored
Create print.html
1 parent 5e721cb commit df130ee

1 file changed

Lines changed: 132 additions & 0 deletions

File tree

‎overrides/print.html‎

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
{% extends "base.html" %}
2+
3+
{% block styles %}
4+
{{ super() }}
5+
<style>
6+
/* ---- Mise en page papier : page print uniquement ---- */
7+
8+
/* Cacher le chrome du site */
9+
.md-header, .md-tabs, .md-sidebar, .md-footer,
10+
.md-top, .md-content__button, .md-nav__link[data-md-state="blur"] {
11+
display: none !important;
12+
}
13+
14+
/* Colonne unique centrée, largeur de lecture papier */
15+
.md-grid {
16+
max-width: 72rem !important;
17+
}
18+
.md-content {
19+
max-width: 100% !important;
20+
margin-inline: auto !important;
21+
}
22+
.md-content__inner {
23+
padding-inline: 0 !important;
24+
}
25+
26+
/* Typographie "livre" : serif, justifié, césures */
27+
.md-typeset {
28+
font-family: "Iowan Old Style", "Palatino Linotype", Palatino,
29+
"Book Antiqua", Georgia, serif;
30+
font-size: 1.1rem;
31+
line-height: 1.65;
32+
hyphens: auto;
33+
-webkit-hyphens: auto;
34+
}
35+
.md-typeset p {
36+
text-align: justify;
37+
}
38+
.md-typeset h1, .md-typeset h2, .md-typeset h3,
39+
.md-typeset h4, .md-typeset h5, .md-typeset h6 {
40+
font-family: inherit;
41+
text-align: left;
42+
}
43+
.md-typeset h1 {
44+
font-size: 1.9rem;
45+
margin-top: 2.5rem;
46+
}
47+
.md-typeset h2 {
48+
font-size: 1.5rem;
49+
margin-top: 2rem;
50+
}
51+
.md-typeset code, .md-typeset pre {
52+
font-size: 0.85em;
53+
}
54+
55+
/* Sommaire : liste numérotée aérée */
56+
#sommaire + ul {
57+
list-style-type: none;
58+
counter-reset: tocitem;
59+
padding-left: 0;
60+
}
61+
#sommaire + ul > li {
62+
counter-increment: tocitem;
63+
margin-bottom: 0.35rem;
64+
}
65+
#sommaire + ul > li::before {
66+
content: counter(tocitem, decimal) ". ";
67+
font-weight: bold;
68+
color: var(--md-primary-fg-color, #4051b5);
69+
}
70+
71+
/* Chaque page de la doc (section d'origine) commence sur une nouvelle
72+
feuille : le premier h1 de chaque section d'origine a un id de page. */
73+
h1[id]:not([id="top"]):not([id="sommaire"]) {
74+
break-before: page;
75+
page-break-before: always;
76+
border-bottom: 1px solid #ccc;
77+
padding-bottom: 0.3rem;
78+
}
79+
80+
/* ---- Ctrl+P / impression ---- */
81+
@media print {
82+
.md-typeset {
83+
font-size: 11pt;
84+
}
85+
.md-typeset img, .md-typeset video {
86+
max-width: 100% !important;
87+
break-inside: avoid;
88+
}
89+
.md-typeset pre, .md-typeset code {
90+
white-space: pre-wrap !important;
91+
word-break: break-word;
92+
}
93+
h1, h2, h3 { break-after: avoid; page-break-after: avoid; }
94+
h1, h2, h3, h4, h5, h6,
95+
table, figure, blockquote { break-inside: avoid; page-break-inside: avoid; }
96+
table { width: 100% !important; font-size: 10pt; }
97+
a { color: #1a5fb4 !important; text-decoration: none; }
98+
/* Fond blanc forcé même en dark mode */
99+
html, body {
100+
background: #fff !important;
101+
}
102+
.md-typeset, .md-typeset p, .md-typeset li {
103+
color: #000 !important;
104+
}
105+
.md-typeset pre {
106+
background: #f5f5f5 !important;
107+
border: 1px solid #ddd;
108+
}
109+
/* Afficher tous les contenus d'onglets */
110+
.tabbed-set .tabbed-content {
111+
display: block !important;
112+
}
113+
}
114+
</style>
115+
{% endblock %}
116+
117+
{% block scripts %}
118+
{{ super() }}
119+
<script>
120+
// Déplier les admonitions repliables et activer tous les tabs
121+
// avant l'impression (Ctrl+P) et avant l'aperçu.
122+
const expandAll = () => {
123+
document.querySelectorAll('details').forEach(d => { d.open = true; });
124+
document.querySelectorAll('.tabbed-set input[type="radio"]')
125+
.forEach(r => { r.checked = false; });
126+
};
127+
window.addEventListener('beforeprint', expandAll);
128+
window.addEventListener('pagehide', expandAll);
129+
// au chargement : tout déplier aussi à l'écran (page "papier")
130+
document.addEventListener('DOMContentLoaded', expandAll);
131+
</script>
132+
{% endblock %}

0 commit comments

Comments
 (0)