markdownr 0.5.3 → 0.5.4
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.
- checksums.yaml +4 -4
- data/lib/markdown_server/version.rb +1 -1
- data/views/layout.erb +125 -8
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d8c9a7eee19198ff1effccac6edfac5938353e964073a25abaf44d90f3fcf9ce
|
|
4
|
+
data.tar.gz: 85bc3bc0825aceef42b0fe6ecbb5f3b753a0b0b8b3facc084b6e8c25f042439a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b3d9654e8b565eb97ba6571fe742855dd5e7580402dc558526fa445e388b803872d6c23dbbb4e684e8ae7b9276dc8e96d4bebc824c7dfa5c07f99cde2ca6624e
|
|
7
|
+
data.tar.gz: e81586f4f208d925c453a915b1601b5ccad5a1353ad139e19af984f810a49071a0b952eaf548b74e53159c6d7e1302d6bb86f3ab0814fd9615c5b398b381068d
|
data/views/layout.erb
CHANGED
|
@@ -20,10 +20,41 @@
|
|
|
20
20
|
max-width: 900px;
|
|
21
21
|
margin: 0 auto;
|
|
22
22
|
padding: 1.5rem 2rem 3rem;
|
|
23
|
+
transition: max-width 0.25s ease, margin-left 0.25s ease;
|
|
23
24
|
}
|
|
24
25
|
.container.has-toc {
|
|
25
26
|
max-width: 1150px;
|
|
26
27
|
}
|
|
28
|
+
body.wide-mode .container,
|
|
29
|
+
body.wide-mode .container.has-toc {
|
|
30
|
+
margin-left: 0 !important;
|
|
31
|
+
max-width: 100vw !important;
|
|
32
|
+
}
|
|
33
|
+
/* When right sidebar has content, shrink container to leave room */
|
|
34
|
+
body.wide-mode:has(.right-sidebar:not(:empty)) .container,
|
|
35
|
+
body.wide-mode:has(.right-sidebar:not(:empty)) .container.has-toc {
|
|
36
|
+
max-width: calc(100vw - 220px) !important;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* Right sidebar — empty placeholder, shown in wide mode only when it has content */
|
|
40
|
+
.right-sidebar {
|
|
41
|
+
display: none;
|
|
42
|
+
position: fixed;
|
|
43
|
+
right: 0;
|
|
44
|
+
top: 0;
|
|
45
|
+
bottom: 0;
|
|
46
|
+
width: 220px;
|
|
47
|
+
border-left: 1px solid #e0d8c8;
|
|
48
|
+
background: #faf8f4;
|
|
49
|
+
padding: 1rem;
|
|
50
|
+
overflow-y: auto;
|
|
51
|
+
z-index: 10;
|
|
52
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
|
53
|
+
font-size: 0.8rem;
|
|
54
|
+
}
|
|
55
|
+
body.wide-mode .right-sidebar:not(:empty) {
|
|
56
|
+
display: block;
|
|
57
|
+
}
|
|
27
58
|
|
|
28
59
|
/* Breadcrumbs */
|
|
29
60
|
.breadcrumbs {
|
|
@@ -230,11 +261,40 @@
|
|
|
230
261
|
.md-content li { margin-bottom: 0.3rem; }
|
|
231
262
|
|
|
232
263
|
/* Tables */
|
|
264
|
+
.table-outer {
|
|
265
|
+
position: relative;
|
|
266
|
+
margin: 1rem 0;
|
|
267
|
+
}
|
|
233
268
|
.table-wrap {
|
|
234
269
|
overflow-x: auto;
|
|
235
|
-
margin: 1rem 0;
|
|
236
270
|
-webkit-overflow-scrolling: touch;
|
|
237
271
|
}
|
|
272
|
+
.table-expand-btn {
|
|
273
|
+
position: fixed;
|
|
274
|
+
right: 6px;
|
|
275
|
+
z-index: 50;
|
|
276
|
+
display: none;
|
|
277
|
+
background: rgba(250, 248, 244, 0.92);
|
|
278
|
+
border: 1px solid #ccc;
|
|
279
|
+
border-radius: 4px;
|
|
280
|
+
padding: 4px 7px;
|
|
281
|
+
cursor: pointer;
|
|
282
|
+
font-size: 1rem;
|
|
283
|
+
line-height: 1;
|
|
284
|
+
color: #aaa;
|
|
285
|
+
box-shadow: 0 1px 4px rgba(0,0,0,0.1);
|
|
286
|
+
transition: color 0.15s, border-color 0.15s, background 0.15s;
|
|
287
|
+
transform: translateY(-50%);
|
|
288
|
+
}
|
|
289
|
+
.table-expand-btn:hover {
|
|
290
|
+
color: #555;
|
|
291
|
+
border-color: #999;
|
|
292
|
+
background: #fff;
|
|
293
|
+
}
|
|
294
|
+
.table-expand-btn.is-expanded {
|
|
295
|
+
color: #8b6914;
|
|
296
|
+
border-color: #c8a84b;
|
|
297
|
+
}
|
|
238
298
|
.md-content table {
|
|
239
299
|
border-collapse: collapse;
|
|
240
300
|
width: 100%;
|
|
@@ -944,6 +1004,8 @@
|
|
|
944
1004
|
<%= yield %>
|
|
945
1005
|
</div>
|
|
946
1006
|
|
|
1007
|
+
<div class="right-sidebar"></div>
|
|
1008
|
+
|
|
947
1009
|
<script>
|
|
948
1010
|
// Breadcrumb auto-hide: visible on load for 5s, hides on scroll down,
|
|
949
1011
|
// shows for 5s on scroll up then hides again
|
|
@@ -1017,16 +1079,71 @@
|
|
|
1017
1079
|
});
|
|
1018
1080
|
})();
|
|
1019
1081
|
|
|
1020
|
-
// Wrap tables in scrollable containers
|
|
1082
|
+
// Wrap tables in scrollable containers + add expand buttons
|
|
1083
|
+
var _tableItems = [];
|
|
1021
1084
|
document.querySelectorAll('.md-content table').forEach(function(table) {
|
|
1022
|
-
if (
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1085
|
+
if (table.closest('.table-wrap')) return;
|
|
1086
|
+
|
|
1087
|
+
var outer = document.createElement('div');
|
|
1088
|
+
outer.className = 'table-outer';
|
|
1089
|
+
|
|
1090
|
+
var wrapper = document.createElement('div');
|
|
1091
|
+
wrapper.className = 'table-wrap';
|
|
1092
|
+
|
|
1093
|
+
table.parentNode.insertBefore(outer, table);
|
|
1094
|
+
outer.appendChild(wrapper);
|
|
1095
|
+
wrapper.appendChild(table);
|
|
1096
|
+
|
|
1097
|
+
var btn = document.createElement('button');
|
|
1098
|
+
btn.className = 'table-expand-btn';
|
|
1099
|
+
btn.title = 'Expand table to full width';
|
|
1100
|
+
btn.setAttribute('aria-label', 'Expand table to full width');
|
|
1101
|
+
btn.innerHTML = '⤢';
|
|
1102
|
+
btn.addEventListener('click', function() {
|
|
1103
|
+
var isOn = document.body.classList.toggle('wide-mode');
|
|
1104
|
+
_tableItems.forEach(function(i) {
|
|
1105
|
+
var active = isOn && i.btn === btn;
|
|
1106
|
+
i.btn.classList.toggle('is-expanded', active);
|
|
1107
|
+
i.btn.innerHTML = active ? '⤡' : '⤢';
|
|
1108
|
+
i.btn.title = active ? 'Collapse table' : 'Expand table to full width';
|
|
1109
|
+
i.btn.setAttribute('aria-label', i.btn.title);
|
|
1110
|
+
});
|
|
1111
|
+
_updateTableBtns();
|
|
1112
|
+
});
|
|
1113
|
+
document.body.appendChild(btn);
|
|
1114
|
+
_tableItems.push({ outer: outer, btn: btn });
|
|
1028
1115
|
});
|
|
1029
1116
|
|
|
1117
|
+
function _updateTableBtns() {
|
|
1118
|
+
var containerEl = document.querySelector('.container');
|
|
1119
|
+
if (!containerEl) return;
|
|
1120
|
+
// Use the container's natural max-width (ignoring wide-mode expansion) so the
|
|
1121
|
+
// button position is stable before and after toggling wide mode.
|
|
1122
|
+
var naturalMaxWidth = containerEl.classList.contains('has-toc') ? 1150 : 900;
|
|
1123
|
+
var naturalWidth = Math.min(naturalMaxWidth, window.innerWidth);
|
|
1124
|
+
// Right gap = space to the right of a centered container of naturalWidth
|
|
1125
|
+
var rightGap = Math.round((window.innerWidth - naturalWidth) / 2);
|
|
1126
|
+
if (rightGap < 60) {
|
|
1127
|
+
_tableItems.forEach(function(item) { item.btn.style.display = 'none'; });
|
|
1128
|
+
return;
|
|
1129
|
+
}
|
|
1130
|
+
_tableItems.forEach(function(item) {
|
|
1131
|
+
var r = item.outer.getBoundingClientRect();
|
|
1132
|
+
var inView = r.top < window.innerHeight - 20 && r.bottom > 55;
|
|
1133
|
+
if (inView) {
|
|
1134
|
+
var visTop = Math.max(r.top, 55);
|
|
1135
|
+
var visBot = Math.min(r.bottom, window.innerHeight);
|
|
1136
|
+
item.btn.style.top = Math.round((visTop + visBot) / 2) + 'px';
|
|
1137
|
+
item.btn.style.display = 'block';
|
|
1138
|
+
} else {
|
|
1139
|
+
item.btn.style.display = 'none';
|
|
1140
|
+
}
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
window.addEventListener('scroll', _updateTableBtns, { passive: true });
|
|
1144
|
+
window.addEventListener('resize', _updateTableBtns);
|
|
1145
|
+
_updateTableBtns();
|
|
1146
|
+
|
|
1030
1147
|
// TOC scroll spy — highlight the nearest heading (sidebar + drawer)
|
|
1031
1148
|
(function() {
|
|
1032
1149
|
var sidebarLinks = document.querySelectorAll('.toc-sidebar a');
|