@rip-lang/print 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/print.rip +11 -2
package/package.json
CHANGED
package/print.rip
CHANGED
|
@@ -204,7 +204,8 @@ def highlightCode(code, lang)
|
|
|
204
204
|
lines = highlighted.split('\n')
|
|
205
205
|
numbered = lines.map (line, i) ->
|
|
206
206
|
num = String(i + 1).padStart(4)
|
|
207
|
-
|
|
207
|
+
cls = if i is 0 then 'line-num first' else 'line-num'
|
|
208
|
+
"<span class=\"#{cls}\">#{num}</span> #{line}"
|
|
208
209
|
numbered.join('\n')
|
|
209
210
|
|
|
210
211
|
sections = []
|
|
@@ -313,7 +314,7 @@ html = """
|
|
|
313
314
|
<html lang="en">
|
|
314
315
|
<head>
|
|
315
316
|
<meta charset="utf-8">
|
|
316
|
-
<title>
|
|
317
|
+
<title>Rip Print - #{new Date().toLocaleDateString('en-US', { year: 'numeric', month: 'short', day: 'numeric' })} at #{new Date().toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit' }).toLowerCase()}</title>
|
|
317
318
|
<link rel="icon" href="data:,">
|
|
318
319
|
<style id="hljs-theme">#{defaultCss}</style>
|
|
319
320
|
<style>
|
|
@@ -345,6 +346,7 @@ html = """
|
|
|
345
346
|
.code-container pre { margin: 0; border-radius: 0; }
|
|
346
347
|
.code-container code { font-size: 13px; line-height: 1.5; padding: 0 !important; display: block; }
|
|
347
348
|
.line-num { color: #aaa; background: #{if dark then '#161b22' else '#f4f4f4'}; user-select: none; display: inline-block; min-width: 2em; text-align: right; padding: 0 0.7em; margin-right: 0.7em; border-right: 1px solid #{borderColor}; }
|
|
349
|
+
.line-num.first { padding-top: 4px; }
|
|
348
350
|
|
|
349
351
|
@media print {
|
|
350
352
|
.toc { page-break-after: always; }
|
|
@@ -370,8 +372,15 @@ html = """
|
|
|
370
372
|
var themes = {
|
|
371
373
|
#{themeData}
|
|
372
374
|
};
|
|
375
|
+
// Restore saved theme
|
|
376
|
+
var saved = localStorage.getItem('rip-print-theme');
|
|
377
|
+
if (saved && themes[saved]) {
|
|
378
|
+
document.getElementById('theme-picker').value = saved;
|
|
379
|
+
document.getElementById('theme-picker').dispatchEvent(new Event('change'));
|
|
380
|
+
}
|
|
373
381
|
document.getElementById('theme-picker').addEventListener('change', function(e) {
|
|
374
382
|
var id = e.target.value;
|
|
383
|
+
localStorage.setItem('rip-print-theme', id);
|
|
375
384
|
var t = themes[id];
|
|
376
385
|
if (!t) return;
|
|
377
386
|
document.getElementById('hljs-theme').textContent = t.c;
|