madness 1.2.5 → 1.3.0
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/README.md +23 -1
- data/app/public/css/main.css +652 -401
- data/app/public/css/main.css.map +17 -19
- data/app/public/js/theme.js +81 -0
- data/app/public/js/vendor/mermaid.min.js +1509 -915
- data/app/styles/_anchor.scss +11 -3
- data/app/styles/_breadcrumbs.scss +8 -1
- data/app/styles/_code.scss +26 -8
- data/app/styles/_footnotes.scss +29 -0
- data/app/styles/_general.scss +6 -3
- data/app/styles/_image.scss +18 -0
- data/app/styles/_keyboard.scss +6 -4
- data/app/styles/_manifest.scss +1 -2
- data/app/styles/_nav.scss +200 -16
- data/app/styles/_pandoc_code.scss +55 -51
- data/app/styles/_rouge.scss +57 -211
- data/app/styles/_scrollbar.scss +17 -3
- data/app/styles/_search.scss +20 -8
- data/app/styles/_table.scss +6 -5
- data/app/styles/_typography.scss +44 -16
- data/app/styles/_variables.scss +216 -35
- data/app/views/_icon.slim +23 -0
- data/app/views/_mobile_search.slim +1 -1
- data/app/views/_nav.slim +18 -8
- data/app/views/_nav_tree.slim +13 -0
- data/app/views/layout.slim +26 -1
- data/lib/madness/directory.rb +7 -0
- data/lib/madness/item.rb +1 -0
- data/lib/madness/navigation.rb +24 -0
- data/lib/madness/rendering/pandoc.rb +2 -1
- data/lib/madness/rendering/redcarpet_custom.rb +6 -1
- data/lib/madness/settings.rb +1 -0
- data/lib/madness/templates/madness.yml +5 -0
- data/lib/madness/version.rb +1 -1
- metadata +5 -8
- data/app/public/font/fontello.eot +0 -0
- data/app/public/font/fontello.svg +0 -16
- data/app/public/font/fontello.ttf +0 -0
- data/app/public/font/fontello.woff +0 -0
- data/app/public/font/fontello.woff2 +0 -0
- data/app/styles/_fontello.scss +0 -59
data/app/styles/_variables.scss
CHANGED
|
@@ -1,39 +1,220 @@
|
|
|
1
|
+
// Theme variables.
|
|
2
|
+
//
|
|
3
|
+
// Light palette lives on :root. Dark palette overrides apply when either the
|
|
4
|
+
// system prefers dark OR the user has explicitly chosen dark via the toggle
|
|
5
|
+
// (data-theme="dark" on <html>). An explicit data-theme="light" wins back
|
|
6
|
+
// even when the system prefers dark.
|
|
7
|
+
|
|
1
8
|
:root {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
--
|
|
6
|
-
--
|
|
7
|
-
--
|
|
8
|
-
--
|
|
9
|
-
--
|
|
10
|
-
--
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
--
|
|
14
|
-
--
|
|
15
|
-
--
|
|
16
|
-
--
|
|
17
|
-
--
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
--
|
|
21
|
-
--
|
|
22
|
-
--
|
|
23
|
-
--
|
|
24
|
-
--
|
|
25
|
-
--
|
|
26
|
-
--
|
|
27
|
-
--
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
--
|
|
31
|
-
--
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
--
|
|
9
|
+
color-scheme: light dark;
|
|
10
|
+
|
|
11
|
+
// Surfaces
|
|
12
|
+
--background-color: #fdfdfd;
|
|
13
|
+
--sidebar-bg-color: #fafafa;
|
|
14
|
+
--sidebar-border-color: #ececec;
|
|
15
|
+
--sidebar-border-right-color: #e4e4e4;
|
|
16
|
+
--sidebar-hover-bg-color: #f0f0f0;
|
|
17
|
+
--sidebar-active-bg-color: #eef3fb;
|
|
18
|
+
|
|
19
|
+
// Typography
|
|
20
|
+
--font-color: #1f2328;
|
|
21
|
+
--font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
|
|
22
|
+
--font-family-monospace: ui-monospace, "SFMono-Regular", "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
|
|
23
|
+
--quiet-color: #656d76;
|
|
24
|
+
--footnotes-color: #656d76;
|
|
25
|
+
|
|
26
|
+
// Headings
|
|
27
|
+
--h1-color: #1f2328;
|
|
28
|
+
--h1-border-color: #eaeef2;
|
|
29
|
+
--h2-color: #1f2328;
|
|
30
|
+
--h2-border-color: #eaeef2;
|
|
31
|
+
--h3-color: #1f2328;
|
|
32
|
+
--h4-color: #1f2328;
|
|
33
|
+
--h5-color: #1f2328;
|
|
34
|
+
--h6-color: #656d76;
|
|
35
|
+
|
|
36
|
+
// Links
|
|
37
|
+
--link-color: #0969da;
|
|
38
|
+
--link-hover-color: #0550ae;
|
|
39
|
+
|
|
40
|
+
// Code
|
|
41
|
+
--code-border-color: #eaeef2;
|
|
42
|
+
--code-bg-color: #f6f8fa;
|
|
43
|
+
--inline-code-bg-color: #f6f8fa;
|
|
44
|
+
--inline-code-color: #1f2328;
|
|
45
|
+
|
|
46
|
+
// Blockquote
|
|
47
|
+
--blockquote-color: #656d76;
|
|
48
|
+
--blockquote-border-color: #d0d7de;
|
|
49
|
+
|
|
50
|
+
// Tables
|
|
51
|
+
--table-border-color: #eaeef2;
|
|
35
52
|
--table-bg-color: transparent;
|
|
36
|
-
--table-
|
|
37
|
-
--table-header-bg-color: transparent;
|
|
53
|
+
--table-header-bg-color: #f6f8fa;
|
|
38
54
|
--table-row-bg-color: transparent;
|
|
55
|
+
--table-alt-row-bg-color: #fafbfc;
|
|
56
|
+
|
|
57
|
+
// Search
|
|
58
|
+
--search-field-bg-color: #ffffff;
|
|
59
|
+
--search-field-border-color: #d0d7de;
|
|
60
|
+
--search-field-focused-border-color: #0969da;
|
|
61
|
+
--search-field-shadow-color: rgba(9, 105, 218, 0.18);
|
|
62
|
+
|
|
63
|
+
// Keyboard
|
|
64
|
+
--kbd-color: #1f2328;
|
|
65
|
+
--kbd-bg-color: #f6f8fa;
|
|
66
|
+
--kbd-border-color: #d0d7de;
|
|
67
|
+
--kbd-shadow-color: #afb8c1;
|
|
68
|
+
|
|
69
|
+
// Misc
|
|
70
|
+
--highlight-color: #fff8c5;
|
|
71
|
+
--highlight-text-color: #1f2328;
|
|
72
|
+
--hr-color: #eaeef2;
|
|
73
|
+
--scrollbar-color: #d0d7de;
|
|
74
|
+
--scrollbar-hover-color: #afb8c1;
|
|
75
|
+
--breadcrumbs-border-color: #eaeef2;
|
|
76
|
+
--selection-bg-color: rgba(9, 105, 218, 0.20);
|
|
77
|
+
--selection-color: inherit;
|
|
78
|
+
--focus-ring-color: rgba(9, 105, 218, 0.40);
|
|
79
|
+
|
|
80
|
+
// Rouge syntax (light — derived from GitHub light)
|
|
81
|
+
--rouge-bg: var(--code-bg-color);
|
|
82
|
+
--rouge-fg: #1f2328;
|
|
83
|
+
--rouge-comment: #6e7781;
|
|
84
|
+
--rouge-comment-strong: #6e7781;
|
|
85
|
+
--rouge-error-fg: #82071e;
|
|
86
|
+
--rouge-error-bg: #ffebe9;
|
|
87
|
+
--rouge-keyword: #cf222e;
|
|
88
|
+
--rouge-operator: #cf222e;
|
|
89
|
+
--rouge-name: #1f2328;
|
|
90
|
+
--rouge-name-attribute: #116329;
|
|
91
|
+
--rouge-name-builtin: #953800;
|
|
92
|
+
--rouge-name-class: #953800;
|
|
93
|
+
--rouge-name-constant: #0550ae;
|
|
94
|
+
--rouge-name-function: #8250df;
|
|
95
|
+
--rouge-name-tag: #116329;
|
|
96
|
+
--rouge-name-variable: #953800;
|
|
97
|
+
--rouge-literal-string: #0a3069;
|
|
98
|
+
--rouge-literal-number: #0550ae;
|
|
99
|
+
--rouge-literal-regex: #0a3069;
|
|
100
|
+
--rouge-generic-deleted-fg: #82071e;
|
|
101
|
+
--rouge-generic-deleted-bg: #ffebe9;
|
|
102
|
+
--rouge-generic-inserted-fg: #116329;
|
|
103
|
+
--rouge-generic-inserted-bg: #dafbe1;
|
|
104
|
+
--rouge-generic-heading: #0550ae;
|
|
105
|
+
--rouge-generic-subheading: #0550ae;
|
|
106
|
+
--rouge-line-number: #8c959f;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Manual override: user picked light.
|
|
110
|
+
:root[data-theme="light"] {
|
|
111
|
+
// Inherits :root defaults. Block exists so dark @media doesn't override it.
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@mixin dark-palette {
|
|
115
|
+
color-scheme: dark;
|
|
116
|
+
|
|
117
|
+
// Surfaces
|
|
118
|
+
--background-color: #0d1117;
|
|
119
|
+
--sidebar-bg-color: #010409;
|
|
120
|
+
--sidebar-border-color: #21262d;
|
|
121
|
+
--sidebar-border-right-color: #21262d;
|
|
122
|
+
--sidebar-hover-bg-color: #161b22;
|
|
123
|
+
--sidebar-active-bg-color: #1f2937;
|
|
124
|
+
|
|
125
|
+
// Typography
|
|
126
|
+
--font-color: #e6edf3;
|
|
127
|
+
--quiet-color: #8d96a0;
|
|
128
|
+
--footnotes-color: #8d96a0;
|
|
129
|
+
|
|
130
|
+
// Headings
|
|
131
|
+
--h1-color: #f0f6fc;
|
|
132
|
+
--h1-border-color: #21262d;
|
|
133
|
+
--h2-color: #f0f6fc;
|
|
134
|
+
--h2-border-color: #21262d;
|
|
135
|
+
--h3-color: #f0f6fc;
|
|
136
|
+
--h4-color: #f0f6fc;
|
|
137
|
+
--h5-color: #f0f6fc;
|
|
138
|
+
--h6-color: #8d96a0;
|
|
139
|
+
|
|
140
|
+
// Links
|
|
141
|
+
--link-color: #58a6ff;
|
|
142
|
+
--link-hover-color: #79b8ff;
|
|
143
|
+
|
|
144
|
+
// Code
|
|
145
|
+
--code-border-color: #30363d;
|
|
146
|
+
--code-bg-color: #161b22;
|
|
147
|
+
--inline-code-bg-color: rgba(110, 118, 129, 0.30);
|
|
148
|
+
--inline-code-color: #e6edf3;
|
|
149
|
+
|
|
150
|
+
// Blockquote
|
|
151
|
+
--blockquote-color: #8d96a0;
|
|
152
|
+
--blockquote-border-color: #30363d;
|
|
153
|
+
|
|
154
|
+
// Tables
|
|
155
|
+
--table-border-color: #30363d;
|
|
156
|
+
--table-header-bg-color: #161b22;
|
|
157
|
+
--table-alt-row-bg-color: #0f1419;
|
|
158
|
+
|
|
159
|
+
// Search
|
|
160
|
+
--search-field-bg-color: #0d1117;
|
|
161
|
+
--search-field-border-color: #30363d;
|
|
162
|
+
--search-field-focused-border-color: #58a6ff;
|
|
163
|
+
--search-field-shadow-color: rgba(88, 166, 255, 0.25);
|
|
164
|
+
|
|
165
|
+
// Keyboard
|
|
166
|
+
--kbd-color: #e6edf3;
|
|
167
|
+
--kbd-bg-color: #161b22;
|
|
168
|
+
--kbd-border-color: #30363d;
|
|
169
|
+
--kbd-shadow-color: #30363d;
|
|
170
|
+
|
|
171
|
+
// Misc
|
|
172
|
+
--highlight-color: rgba(187, 128, 9, 0.40);
|
|
173
|
+
--highlight-text-color: #f0f6fc;
|
|
174
|
+
--hr-color: #21262d;
|
|
175
|
+
--scrollbar-color: #30363d;
|
|
176
|
+
--scrollbar-hover-color: #484f58;
|
|
177
|
+
--breadcrumbs-border-color: #21262d;
|
|
178
|
+
--selection-bg-color: rgba(56, 139, 253, 0.30);
|
|
179
|
+
--focus-ring-color: rgba(88, 166, 255, 0.45);
|
|
180
|
+
|
|
181
|
+
// Rouge syntax (dark — derived from GitHub dark)
|
|
182
|
+
--rouge-bg: var(--code-bg-color);
|
|
183
|
+
--rouge-fg: #e6edf3;
|
|
184
|
+
--rouge-comment: #8b949e;
|
|
185
|
+
--rouge-comment-strong: #8b949e;
|
|
186
|
+
--rouge-error-fg: #ffa198;
|
|
187
|
+
--rouge-error-bg: rgba(248, 81, 73, 0.15);
|
|
188
|
+
--rouge-keyword: #ff7b72;
|
|
189
|
+
--rouge-operator: #ff7b72;
|
|
190
|
+
--rouge-name: #e6edf3;
|
|
191
|
+
--rouge-name-attribute: #7ee787;
|
|
192
|
+
--rouge-name-builtin: #ffa657;
|
|
193
|
+
--rouge-name-class: #ffa657;
|
|
194
|
+
--rouge-name-constant: #79c0ff;
|
|
195
|
+
--rouge-name-function: #d2a8ff;
|
|
196
|
+
--rouge-name-tag: #7ee787;
|
|
197
|
+
--rouge-name-variable: #ffa657;
|
|
198
|
+
--rouge-literal-string: #a5d6ff;
|
|
199
|
+
--rouge-literal-number: #79c0ff;
|
|
200
|
+
--rouge-literal-regex: #7ee787;
|
|
201
|
+
--rouge-generic-deleted-fg: #ffdcd7;
|
|
202
|
+
--rouge-generic-deleted-bg: rgba(248, 81, 73, 0.15);
|
|
203
|
+
--rouge-generic-inserted-fg: #aff5b4;
|
|
204
|
+
--rouge-generic-inserted-bg: rgba(46, 160, 67, 0.15);
|
|
205
|
+
--rouge-generic-heading: #79c0ff;
|
|
206
|
+
--rouge-generic-subheading: #79c0ff;
|
|
207
|
+
--rouge-line-number: #6e7681;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// System dark — apply unless user explicitly chose light.
|
|
211
|
+
@media (prefers-color-scheme: dark) {
|
|
212
|
+
:root:not([data-theme="light"]) {
|
|
213
|
+
@include dark-palette;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Manual dark override — wins over system preference.
|
|
218
|
+
:root[data-theme="dark"] {
|
|
219
|
+
@include dark-palette;
|
|
39
220
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
- case name.to_sym
|
|
2
|
+
- when :home
|
|
3
|
+
svg.icon-svg viewBox="0 0 24 24" aria-hidden="true"
|
|
4
|
+
path d="M3 10.75 12 3l9 7.75"
|
|
5
|
+
path d="M5 9.25V21h5v-6h4v6h5V9.25"
|
|
6
|
+
- when :search
|
|
7
|
+
svg.icon-svg viewBox="0 0 24 24" aria-hidden="true"
|
|
8
|
+
circle cx="11" cy="11" r="7"
|
|
9
|
+
line x1="16.5" y1="16.5" x2="21" y2="21"
|
|
10
|
+
- when :moon
|
|
11
|
+
svg.icon-svg.icon-moon viewBox="0 0 24 24" aria-hidden="true"
|
|
12
|
+
path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"
|
|
13
|
+
- when :sun
|
|
14
|
+
svg.icon-svg.icon-sun viewBox="0 0 24 24" aria-hidden="true"
|
|
15
|
+
circle cx="12" cy="12" r="4"
|
|
16
|
+
line x1="12" y1="2" x2="12" y2="4"
|
|
17
|
+
line x1="12" y1="20" x2="12" y2="22"
|
|
18
|
+
line x1="2" y1="12" x2="4" y2="12"
|
|
19
|
+
line x1="20" y1="12" x2="22" y2="12"
|
|
20
|
+
line x1="4.93" y1="4.93" x2="6.34" y2="6.34"
|
|
21
|
+
line x1="17.66" y1="17.66" x2="19.07" y2="19.07"
|
|
22
|
+
line x1="4.93" y1="19.07" x2="6.34" y2="17.66"
|
|
23
|
+
line x1="17.66" y1="6.34" x2="19.07" y2="4.93"
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
a#mobile-search href="#{config.base_uri}/_search"
|
|
2
|
-
|
|
2
|
+
== slim :_icon, locals: { name: :search }
|
data/app/views/_nav.slim
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
nav
|
|
2
2
|
.icon-bar
|
|
3
|
-
a.icon href="#{config.base_uri}/" accesskey='h'
|
|
4
|
-
|
|
3
|
+
a.icon href="#{config.base_uri}/" accesskey='h' title="Home"
|
|
4
|
+
== slim :_icon, locals: { name: :home }
|
|
5
5
|
|
|
6
6
|
- if nav.with_search?
|
|
7
|
-
a.icon href="#{config.base_uri}/_search" accesskey='s'
|
|
8
|
-
|
|
7
|
+
a.icon href="#{config.base_uri}/_search" accesskey='s' title="Search"
|
|
8
|
+
== slim :_icon, locals: { name: :search }
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
.icon-spacer
|
|
11
|
+
|
|
12
|
+
a.icon.theme-toggle href="#" role="button" aria-label="Toggle dark mode" title="Toggle theme"
|
|
13
|
+
== slim :_icon, locals: { name: :moon }
|
|
14
|
+
== slim :_icon, locals: { name: :sun }
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
- if nav.caption && !nav.tree?
|
|
11
18
|
.caption = "#{nav.caption}:"
|
|
12
19
|
|
|
13
|
-
- nav.
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
- if nav.tree?
|
|
21
|
+
== slim :_nav_tree, locals: { items: nav.tree, current_path: nav.current_path }
|
|
22
|
+
- else
|
|
23
|
+
- nav.links.each do |item|
|
|
24
|
+
a.document href="#{item.href}" class=('strong' if item.type == :dir)
|
|
25
|
+
= item.label
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
- items.each do |item|
|
|
2
|
+
- if item.dir? && item.children && item.children.any?
|
|
3
|
+
- is_open = current_path == item.path || current_path.start_with?("#{item.path}/")
|
|
4
|
+
details.tree-folder open=is_open
|
|
5
|
+
summary.tree-summary
|
|
6
|
+
span.tree-chevron aria-hidden="true"
|
|
7
|
+
a.document.strong href="#{item.href}" = item.label
|
|
8
|
+
.tree-children
|
|
9
|
+
== slim :_nav_tree, locals: { items: item.children, current_path: current_path }
|
|
10
|
+
- elsif item.dir?
|
|
11
|
+
a.document.strong href="#{item.href}" = item.label
|
|
12
|
+
- else
|
|
13
|
+
a.document href="#{item.href}" = item.label
|
data/app/views/layout.slim
CHANGED
|
@@ -8,6 +8,16 @@ html
|
|
|
8
8
|
title = locals[:title]
|
|
9
9
|
meta name="HandheldFriendly" content="true"
|
|
10
10
|
meta name="viewport" content="width=device-width, initial-scale=1"
|
|
11
|
+
meta name="color-scheme" content="light dark"
|
|
12
|
+
javascript:
|
|
13
|
+
(function () {
|
|
14
|
+
try {
|
|
15
|
+
var stored = localStorage.getItem('madness-theme');
|
|
16
|
+
if (stored === 'dark' || stored === 'light') {
|
|
17
|
+
document.documentElement.setAttribute('data-theme', stored);
|
|
18
|
+
}
|
|
19
|
+
} catch (e) {}
|
|
20
|
+
})();
|
|
11
21
|
link href='#{config.base_uri}/css/main.css' rel='stylesheet' type='text/css'
|
|
12
22
|
- custom_css.each do |file|
|
|
13
23
|
link href="#{config.base_uri}/#{file}" rel='stylesheet' type='text/css'
|
|
@@ -20,7 +30,22 @@ html
|
|
|
20
30
|
- if config.mermaid
|
|
21
31
|
script src="#{config.base_uri}/js/vendor/mermaid.min.js"
|
|
22
32
|
javascript:
|
|
23
|
-
|
|
33
|
+
(function () {
|
|
34
|
+
function currentTheme() {
|
|
35
|
+
var t = document.documentElement.getAttribute('data-theme');
|
|
36
|
+
if (t) return t;
|
|
37
|
+
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
38
|
+
}
|
|
39
|
+
window.mermaid.initialize({
|
|
40
|
+
startOnLoad: true,
|
|
41
|
+
theme: currentTheme() === 'dark' ? 'dark' : 'default'
|
|
42
|
+
});
|
|
43
|
+
})();
|
|
44
|
+
|
|
45
|
+
script src="#{config.base_uri}/js/theme.js" defer=true
|
|
24
46
|
|
|
25
47
|
body
|
|
26
48
|
== yield
|
|
49
|
+
a.floating-theme-toggle href="#" role="button" aria-label="Toggle dark mode" title="Toggle theme"
|
|
50
|
+
== slim :_icon, locals: { name: :moon }
|
|
51
|
+
== slim :_icon, locals: { name: :sun }
|
data/lib/madness/directory.rb
CHANGED
data/lib/madness/item.rb
CHANGED
data/lib/madness/navigation.rb
CHANGED
|
@@ -20,6 +20,18 @@ module Madness
|
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
+
def tree?
|
|
24
|
+
config.nav_tree
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def tree
|
|
28
|
+
@tree ||= sort_tree(root_directory.tree)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def current_path
|
|
32
|
+
dir
|
|
33
|
+
end
|
|
34
|
+
|
|
23
35
|
def caption
|
|
24
36
|
@caption ||= (dir == docroot ? 'Index' : File.basename(dir).to_label)
|
|
25
37
|
end
|
|
@@ -34,6 +46,18 @@ module Madness
|
|
|
34
46
|
@directory ||= Directory.new(dir)
|
|
35
47
|
end
|
|
36
48
|
|
|
49
|
+
def root_directory
|
|
50
|
+
@root_directory ||= Directory.new(docroot)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def sort_tree(items)
|
|
54
|
+
sorted = config.sort_order == 'mixed' ? items.nat_sort(by: :href) : items
|
|
55
|
+
sorted.each do |item|
|
|
56
|
+
item.children = sort_tree(item.children) if item.dir? && item.children
|
|
57
|
+
end
|
|
58
|
+
sorted
|
|
59
|
+
end
|
|
60
|
+
|
|
37
61
|
def config
|
|
38
62
|
Settings.instance
|
|
39
63
|
end
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require 'cgi'
|
|
1
2
|
require 'pandoc-ruby'
|
|
2
3
|
|
|
3
4
|
module Madness
|
|
@@ -18,7 +19,7 @@ module Madness
|
|
|
18
19
|
|
|
19
20
|
def process_mermaid_blocks(text)
|
|
20
21
|
text.gsub(/```mermaid\s+(.+?)\s+```/m) do
|
|
21
|
-
"<div class='mermaid'>#{$1.strip}</div>"
|
|
22
|
+
"<div class='mermaid'>#{CGI.escapeHTML($1.strip)}</div>"
|
|
22
23
|
end
|
|
23
24
|
end
|
|
24
25
|
end
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require 'cgi'
|
|
1
2
|
require 'redcarpet'
|
|
2
3
|
require 'rouge'
|
|
3
4
|
require 'rouge/plugins/redcarpet'
|
|
@@ -9,7 +10,11 @@ module Madness
|
|
|
9
10
|
|
|
10
11
|
def block_code(code, language)
|
|
11
12
|
if language == 'mermaid'
|
|
12
|
-
|
|
13
|
+
# Escape HTML so diagrams using < > characters (class diagrams with
|
|
14
|
+
# <|-- realization arrows, <<interface>> annotations, etc.) survive
|
|
15
|
+
# the browser's HTML parser. Mermaid reads .textContent, which gives
|
|
16
|
+
# back the decoded source.
|
|
17
|
+
"<div class='mermaid'>#{CGI.escapeHTML(code)}</div>"
|
|
13
18
|
else
|
|
14
19
|
super
|
|
15
20
|
end
|
data/lib/madness/settings.rb
CHANGED
|
@@ -28,6 +28,11 @@ sort_order: dirs_first
|
|
|
28
28
|
# enable sidebar
|
|
29
29
|
sidebar: true
|
|
30
30
|
|
|
31
|
+
# render the sidebar as a recursive tree of the entire docroot, with
|
|
32
|
+
# collapsible folders. when false, the sidebar shows only the current
|
|
33
|
+
# folder's immediate children.
|
|
34
|
+
nav_tree: false
|
|
35
|
+
|
|
31
36
|
# add H1 title to files that do not have one
|
|
32
37
|
auto_h1: true
|
|
33
38
|
|
data/lib/madness/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: madness
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Danny Ben Shitrit
|
|
@@ -228,19 +228,14 @@ files:
|
|
|
228
228
|
- app/public/css/main.css
|
|
229
229
|
- app/public/css/main.css.map
|
|
230
230
|
- app/public/favicon.ico
|
|
231
|
-
- app/public/font/fontello.eot
|
|
232
|
-
- app/public/font/fontello.svg
|
|
233
|
-
- app/public/font/fontello.ttf
|
|
234
|
-
- app/public/font/fontello.woff
|
|
235
|
-
- app/public/font/fontello.woff2
|
|
236
231
|
- app/public/js/clipboard.js
|
|
232
|
+
- app/public/js/theme.js
|
|
237
233
|
- app/public/js/vendor/clipboard.min.js
|
|
238
234
|
- app/public/js/vendor/jquery.min.js
|
|
239
235
|
- app/public/js/vendor/mermaid.min.js
|
|
240
236
|
- app/styles/_anchor.scss
|
|
241
237
|
- app/styles/_breadcrumbs.scss
|
|
242
238
|
- app/styles/_code.scss
|
|
243
|
-
- app/styles/_fontello.scss
|
|
244
239
|
- app/styles/_footnotes.scss
|
|
245
240
|
- app/styles/_general.scss
|
|
246
241
|
- app/styles/_image.scss
|
|
@@ -260,9 +255,11 @@ files:
|
|
|
260
255
|
- app/styles/_variables.scss
|
|
261
256
|
- app/styles/main.scss
|
|
262
257
|
- app/views/_breadcrumbs.slim
|
|
258
|
+
- app/views/_icon.slim
|
|
263
259
|
- app/views/_index_nav.slim
|
|
264
260
|
- app/views/_mobile_search.slim
|
|
265
261
|
- app/views/_nav.slim
|
|
262
|
+
- app/views/_nav_tree.slim
|
|
266
263
|
- app/views/document.slim
|
|
267
264
|
- app/views/layout.slim
|
|
268
265
|
- app/views/search.slim
|
|
@@ -320,7 +317,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
320
317
|
- !ruby/object:Gem::Version
|
|
321
318
|
version: '0'
|
|
322
319
|
requirements: []
|
|
323
|
-
rubygems_version: 4.0.
|
|
320
|
+
rubygems_version: 4.0.3
|
|
324
321
|
specification_version: 4
|
|
325
322
|
summary: Instant Markdown Server
|
|
326
323
|
test_files: []
|
|
Binary file
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" standalone="no"?>
|
|
2
|
-
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
3
|
-
<svg xmlns="http://www.w3.org/2000/svg">
|
|
4
|
-
<metadata>Copyright (C) 2023 by original authors @ fontello.com</metadata>
|
|
5
|
-
<defs>
|
|
6
|
-
<font id="fontello" horiz-adv-x="1000" >
|
|
7
|
-
<font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
|
|
8
|
-
<missing-glyph horiz-adv-x="1000" />
|
|
9
|
-
<glyph glyph-name="home" unicode="" d="M0 340q-2 16 21 37l381 351q23 22 57 22t56-22l381-351q23-21 20-37t-30-15h-91v-305q0-32-23-55t-55-23h-517q-32 0-55 23t-23 55v305h-92q-27 0-30 15z" horiz-adv-x="916.5" />
|
|
10
|
-
|
|
11
|
-
<glyph glyph-name="copy" unicode="" d="M929-61v607q0 8-6 13t-12 5h-607q-8 0-13-5t-5-13v-607q0-7 5-12t13-6h607q7 0 12 6t6 12z m71 607v-607q0-37-26-63t-63-26h-607q-37 0-63 26t-27 63v607q0 37 27 64t63 26h607q37 0 63-26t26-64z m-214 215v-90h-72v90q0 7-5 12t-13 6h-607q-7 0-12-6t-6-12v-607q0-8 6-13t12-5h90v-72h-90q-36 0-63 27t-26 63v607q0 37 26 63t63 26h607q37 0 64-26t26-63z" horiz-adv-x="1000" />
|
|
12
|
-
|
|
13
|
-
<glyph glyph-name="search" unicode="" d="M11 375q-23 87 0 173t87 150q48 49 110 74t128 25q65 0 127-25t110-74q52-52 77-119t21-137-36-132q28-8 49-29l174-173q35-35 35-85t-35-85q-35-35-85-35t-85 35l-173 174q-22 20-30 49-70-35-149-35-66 0-128 25t-110 73q-64 64-87 151z m101 86q0-93 65-158 66-65 159-65 92 0 157 65t66 158-66 158q-66 66-157 66-92 0-159-66-65-65-65-158z" horiz-adv-x="892.6" />
|
|
14
|
-
</font>
|
|
15
|
-
</defs>
|
|
16
|
-
</svg>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/app/styles/_fontello.scss
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
@font-face {
|
|
2
|
-
font-family: 'fontello';
|
|
3
|
-
src: url('../font/fontello.eot?19183580');
|
|
4
|
-
src: url('../font/fontello.eot?19183580#iefix') format('embedded-opentype'),
|
|
5
|
-
url('../font/fontello.woff2?19183580') format('woff2'),
|
|
6
|
-
url('../font/fontello.woff?19183580') format('woff'),
|
|
7
|
-
url('../font/fontello.ttf?19183580') format('truetype'),
|
|
8
|
-
url('../font/fontello.svg?19183580#fontello') format('svg');
|
|
9
|
-
font-weight: normal;
|
|
10
|
-
font-style: normal;
|
|
11
|
-
}
|
|
12
|
-
/* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
|
|
13
|
-
/* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
|
|
14
|
-
/*
|
|
15
|
-
@media screen and (-webkit-min-device-pixel-ratio:0) {
|
|
16
|
-
@font-face {
|
|
17
|
-
font-family: 'fontello';
|
|
18
|
-
src: url('../font/fontello.svg?19183580#fontello') format('svg');
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
*/
|
|
22
|
-
[class^="icon-"]:before, [class*=" icon-"]:before {
|
|
23
|
-
font-family: "fontello";
|
|
24
|
-
font-style: normal;
|
|
25
|
-
font-weight: normal;
|
|
26
|
-
speak: never;
|
|
27
|
-
|
|
28
|
-
display: inline-block;
|
|
29
|
-
text-decoration: inherit;
|
|
30
|
-
width: 1em;
|
|
31
|
-
margin-right: .2em;
|
|
32
|
-
text-align: center;
|
|
33
|
-
/* opacity: .8; */
|
|
34
|
-
|
|
35
|
-
/* For safety - reset parent styles, that can break glyph codes*/
|
|
36
|
-
font-variant: normal;
|
|
37
|
-
text-transform: none;
|
|
38
|
-
|
|
39
|
-
/* fix buttons height, for twitter bootstrap */
|
|
40
|
-
line-height: 1em;
|
|
41
|
-
|
|
42
|
-
/* Animation center compensation - margins should be symmetric */
|
|
43
|
-
/* remove if not needed */
|
|
44
|
-
margin-left: .2em;
|
|
45
|
-
|
|
46
|
-
/* you can be more comfortable with increased icons size */
|
|
47
|
-
/* font-size: 120%; */
|
|
48
|
-
|
|
49
|
-
/* Font smoothing. That was taken from TWBS */
|
|
50
|
-
-webkit-font-smoothing: antialiased;
|
|
51
|
-
-moz-osx-font-smoothing: grayscale;
|
|
52
|
-
|
|
53
|
-
/* Uncomment for 3D effect */
|
|
54
|
-
/* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.icon-home:before { content: '\e806'; } /* '' */
|
|
58
|
-
.icon-copy:before { content: '\f24d'; } /* '' */
|
|
59
|
-
.icon-search:before { content: '\f50d'; } /* '' */
|