Skip to content

Commit 7db393d

Browse files
committed
Update theme/index.hbs to make printing work again
From mdBook cd711bfb1ca161e8a834f4527f3936f818a6f50f
1 parent 0d9d5e0 commit 7db393d

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

second-edition/theme/index.hbs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,14 @@
126126
<body class="light">
127127
<!-- Set the theme before any content is loaded, prevents flash -->
128128
<script type="text/javascript">
129-
var theme = store.get('theme');
129+
var theme = store.get('mdbook-theme');
130130
if (theme === null || theme === undefined) { theme = 'light'; }
131131
$('body').removeClass().addClass(theme);
132132
</script>
133133

134134
<!-- Hide / unhide sidebar before it is displayed -->
135135
<script type="text/javascript">
136-
var sidebar = store.get('sidebar');
136+
var sidebar = store.get('mdbook-sidebar');
137137
if (sidebar === "hidden") { $("html").addClass("sidebar-hidden") }
138138
else if (sidebar === "visible") { $("html").addClass("sidebar-visible") }
139139
</script>
@@ -155,7 +155,9 @@
155155
<h1 class="menu-title">{{ book_title }}</h1>
156156

157157
<div class="right-buttons">
158-
<i id="print-button" class="fa fa-print" title="Print this book"></i>
158+
<a href="print.html">
159+
<i id="print-button" class="fa fa-print" title="Print this book"></i>
160+
</a>
159161
</div>
160162
</div>
161163

@@ -223,6 +225,14 @@
223225
<script src="{{ theme_tomorrow_night_js }}" type="text/javascript" charset="utf-8"></script>
224226
{{/if}}
225227

228+
{{#if is_print}}
229+
<script>
230+
$(document).ready(function() {
231+
window.print();
232+
})
233+
</script>
234+
{{/if}}
235+
226236
<script src="highlight.js"></script>
227237
<script src="book.js"></script>
228238
</body>

0 commit comments

Comments
 (0)