docyard 0.0.1 → 0.2.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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +31 -0
  3. data/.github/ISSUE_TEMPLATE/feature_request.md +19 -0
  4. data/.github/pull_request_template.md +14 -0
  5. data/.github/workflows/ci.yml +49 -0
  6. data/.rubocop.yml +38 -0
  7. data/CHANGELOG.md +52 -0
  8. data/CONTRIBUTING.md +55 -0
  9. data/README.md +174 -3
  10. data/lib/docyard/asset_handler.rb +64 -0
  11. data/lib/docyard/cli.rb +34 -0
  12. data/lib/docyard/constants.rb +23 -0
  13. data/lib/docyard/errors.rb +54 -0
  14. data/lib/docyard/file_watcher.rb +42 -0
  15. data/lib/docyard/initializer.rb +76 -0
  16. data/lib/docyard/logging.rb +43 -0
  17. data/lib/docyard/markdown.rb +61 -0
  18. data/lib/docyard/rack_application.rb +81 -0
  19. data/lib/docyard/renderer.rb +61 -0
  20. data/lib/docyard/router.rb +31 -0
  21. data/lib/docyard/routing/resolution_result.rb +31 -0
  22. data/lib/docyard/server.rb +91 -0
  23. data/lib/docyard/sidebar/file_system_scanner.rb +77 -0
  24. data/lib/docyard/sidebar/renderer.rb +110 -0
  25. data/lib/docyard/sidebar/title_extractor.rb +25 -0
  26. data/lib/docyard/sidebar/tree_builder.rb +59 -0
  27. data/lib/docyard/sidebar_builder.rb +50 -0
  28. data/lib/docyard/templates/assets/css/code.css +214 -0
  29. data/lib/docyard/templates/assets/css/components.css +258 -0
  30. data/lib/docyard/templates/assets/css/layout.css +273 -0
  31. data/lib/docyard/templates/assets/css/main.css +10 -0
  32. data/lib/docyard/templates/assets/css/markdown.css +199 -0
  33. data/lib/docyard/templates/assets/css/reset.css +59 -0
  34. data/lib/docyard/templates/assets/css/typography.css +97 -0
  35. data/lib/docyard/templates/assets/css/variables.css +114 -0
  36. data/lib/docyard/templates/assets/js/reload.js +98 -0
  37. data/lib/docyard/templates/assets/js/theme.js +193 -0
  38. data/lib/docyard/templates/errors/404.html.erb +16 -0
  39. data/lib/docyard/templates/errors/500.html.erb +25 -0
  40. data/lib/docyard/templates/layouts/default.html.erb +51 -0
  41. data/lib/docyard/templates/markdown/core-concepts/file-structure.md.erb +61 -0
  42. data/lib/docyard/templates/markdown/core-concepts/markdown.md.erb +90 -0
  43. data/lib/docyard/templates/markdown/getting-started/installation.md.erb +43 -0
  44. data/lib/docyard/templates/markdown/getting-started/introduction.md.erb +30 -0
  45. data/lib/docyard/templates/markdown/getting-started/quick-start.md.erb +56 -0
  46. data/lib/docyard/templates/markdown/index.md.erb +86 -0
  47. data/lib/docyard/templates/partials/_icons.html.erb +11 -0
  48. data/lib/docyard/templates/partials/_nav_group.html.erb +7 -0
  49. data/lib/docyard/templates/partials/_nav_item.html.erb +3 -0
  50. data/lib/docyard/templates/partials/_nav_leaf.html.erb +1 -0
  51. data/lib/docyard/templates/partials/_nav_list.html.erb +3 -0
  52. data/lib/docyard/templates/partials/_nav_section.html.erb +6 -0
  53. data/lib/docyard/templates/partials/_sidebar.html.erb +6 -0
  54. data/lib/docyard/templates/partials/_sidebar_footer.html.erb +11 -0
  55. data/lib/docyard/utils/path_resolver.rb +30 -0
  56. data/lib/docyard/utils/text_formatter.rb +22 -0
  57. data/lib/docyard/version.rb +1 -1
  58. data/lib/docyard.rb +20 -2
  59. metadata +169 -2
@@ -0,0 +1,273 @@
1
+ /* Page Layout */
2
+
3
+ /* Header */
4
+ .header {
5
+ position: fixed;
6
+ top: 0;
7
+ left: 0;
8
+ right: 0;
9
+ height: var(--header-height);
10
+ background: linear-gradient(to bottom, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
11
+ backdrop-filter: blur(12px);
12
+ border-bottom: 1px solid var(--color-border);
13
+ box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.02);
14
+ z-index: var(--z-header);
15
+ transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
16
+ }
17
+
18
+ .header.hide-on-scroll {
19
+ transform: translateY(-100%);
20
+ }
21
+
22
+ .header-content {
23
+ display: flex;
24
+ align-items: center;
25
+ justify-content: space-between;
26
+ height: 100%;
27
+ padding: var(--space-5) var(--space-6);
28
+ }
29
+
30
+ .header-left {
31
+ display: flex;
32
+ align-items: center;
33
+ gap: var(--space-4);
34
+ }
35
+
36
+ .header-logo {
37
+ display: flex;
38
+ align-items: center;
39
+ text-decoration: none;
40
+ gap: var(--space-3);
41
+ }
42
+
43
+ .header-title {
44
+ font-size: 17px;
45
+ font-weight: var(--font-weight-semibold);
46
+ color: var(--color-text);
47
+ letter-spacing: -0.02em;
48
+ }
49
+
50
+ .header-logo:hover .header-title {
51
+ color: var(--color-primary);
52
+ }
53
+
54
+ .header-logo:hover {
55
+ text-decoration: none;
56
+ }
57
+
58
+ .header-logo:focus-visible {
59
+ outline: 2px solid var(--color-primary);
60
+ outline-offset: 4px;
61
+ border-radius: var(--radius-sm);
62
+ }
63
+
64
+ /* Secondary Header (Mobile Navigation Bar) */
65
+ .secondary-header {
66
+ display: none;
67
+ }
68
+
69
+ @media (max-width: 1024px) {
70
+ .secondary-header {
71
+ display: flex;
72
+ align-items: center;
73
+ justify-content: space-between;
74
+ position: fixed;
75
+ top: var(--header-height);
76
+ left: 0;
77
+ right: 0;
78
+ height: 48px;
79
+ background: var(--color-bg);
80
+ border-bottom: 1px solid var(--color-border);
81
+ padding: 0 var(--space-6);
82
+ z-index: var(--z-secondary-header);
83
+ transition: top 0.3s cubic-bezier(0.4, 0, 0.2, 1);
84
+ box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.02);
85
+ }
86
+
87
+ .secondary-header.shift-up {
88
+ top: 0;
89
+ }
90
+
91
+ .secondary-header-menu {
92
+ display: flex;
93
+ align-items: center;
94
+ gap: var(--space-2);
95
+ background: none;
96
+ border: none;
97
+ padding: var(--space-2);
98
+ font-size: var(--font-size-sm);
99
+ font-weight: var(--font-weight-medium);
100
+ color: var(--color-text);
101
+ cursor: pointer;
102
+ border-radius: var(--radius-md);
103
+ transition: background-color 0.2s ease;
104
+ font-family: var(--font-sans);
105
+ margin-left: calc(-1 * var(--space-2));
106
+ }
107
+
108
+ .secondary-header-menu:hover {
109
+ background-color: var(--color-bg-tertiary);
110
+ }
111
+
112
+ .secondary-header-menu:active {
113
+ background-color: var(--color-border);
114
+ }
115
+
116
+ .secondary-header-menu .icon {
117
+ flex-shrink: 0;
118
+ }
119
+ }
120
+
121
+ /* Main layout container */
122
+ .layout {
123
+ display: flex;
124
+ min-height: calc(100vh - var(--header-height));
125
+ padding-top: var(--header-height);
126
+ }
127
+
128
+ /* Sidebar */
129
+ .sidebar {
130
+ width: var(--sidebar-width);
131
+ height: calc(100vh - var(--header-height));
132
+ position: fixed;
133
+ top: var(--header-height);
134
+ left: 0;
135
+ background-color: var(--color-sidebar-bg);
136
+ border-right: 1px solid var(--color-border);
137
+ overflow-y: auto;
138
+ overflow-x: hidden;
139
+ overflow-anchor: none;
140
+ z-index: var(--z-sidebar);
141
+ display: flex;
142
+ flex-direction: column;
143
+ }
144
+
145
+ .sidebar > nav {
146
+ padding: var(--space-5) var(--space-5);
147
+ overscroll-behavior: contain;
148
+ }
149
+
150
+ /* Sidebar scrollbar styling */
151
+ .sidebar::-webkit-scrollbar {
152
+ width: 0.5rem;
153
+ }
154
+
155
+ .sidebar::-webkit-scrollbar-track {
156
+ background: transparent;
157
+ }
158
+
159
+ .sidebar::-webkit-scrollbar-thumb {
160
+ background: rgba(208, 215, 222, 0.5);
161
+ border-radius: 0.25rem;
162
+ }
163
+
164
+ .sidebar::-webkit-scrollbar-thumb:hover {
165
+ background: rgba(208, 215, 222, 0.7);
166
+ }
167
+
168
+ /* Main content area */
169
+ .layout-main {
170
+ flex: 1;
171
+ margin-left: var(--sidebar-width);
172
+ display: flex;
173
+ flex-direction: column;
174
+ }
175
+
176
+ /* Content wrapper */
177
+ main.content {
178
+ flex: 1;
179
+ max-width: var(--content-max-width);
180
+ width: 100%;
181
+ padding: var(--space-16) var(--space-10);
182
+ margin: 0 auto;
183
+ }
184
+
185
+ /* Mobile Layout */
186
+ @media (max-width: 1024px) {
187
+ .header-content {
188
+ padding: var(--space-4) var(--space-6);
189
+ }
190
+
191
+ .layout {
192
+ padding-top: calc(var(--header-height) + 48px);
193
+ }
194
+
195
+ .sidebar {
196
+ position: fixed;
197
+ top: 0;
198
+ left: 0;
199
+ bottom: 0;
200
+ right: auto;
201
+ width: 20rem;
202
+ max-width: 85vw;
203
+ height: 100vh;
204
+ transform: translateX(-100%);
205
+ transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
206
+ z-index: var(--z-sidebar);
207
+ background-color: var(--color-sidebar-bg);
208
+ box-shadow: none;
209
+ }
210
+
211
+ .sidebar.is-open {
212
+ transform: translateX(0);
213
+ box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
214
+ }
215
+
216
+ .layout-main {
217
+ margin-left: 0;
218
+ }
219
+
220
+ main.content {
221
+ padding: var(--space-6);
222
+ }
223
+ }
224
+
225
+ /* Mobile menu overlay */
226
+ @media (max-width: 1024px) {
227
+ .mobile-overlay {
228
+ position: fixed;
229
+ top: 0;
230
+ left: 0;
231
+ right: 0;
232
+ bottom: 0;
233
+ background-color: rgba(0, 0, 0, 0.5);
234
+ z-index: var(--z-overlay);
235
+ opacity: 0;
236
+ pointer-events: none;
237
+ transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
238
+ }
239
+
240
+ .mobile-overlay.is-visible {
241
+ opacity: 1;
242
+ pointer-events: auto;
243
+ }
244
+ }
245
+
246
+ /* Skip to main content link (accessibility) */
247
+ .skip-link {
248
+ position: absolute;
249
+ top: -40px;
250
+ left: 0;
251
+ background: var(--color-primary);
252
+ color: white;
253
+ padding: var(--space-2) var(--space-4);
254
+ text-decoration: none;
255
+ z-index: 100;
256
+ }
257
+
258
+ .skip-link:focus {
259
+ top: 0;
260
+ }
261
+
262
+ /* Container utilities */
263
+ .container {
264
+ max-width: var(--layout-max-width);
265
+ margin: 0 auto;
266
+ padding: 0 var(--space-6);
267
+ }
268
+
269
+ .container-narrow {
270
+ max-width: var(--content-max-width);
271
+ margin: 0 auto;
272
+ padding: 0 var(--space-6);
273
+ }
@@ -0,0 +1,10 @@
1
+ /* Docyard Default Theme */
2
+
3
+ /* Import order matters - each layer builds on the previous */
4
+ @import url('reset.css');
5
+ @import url('variables.css');
6
+ @import url('typography.css');
7
+ @import url('layout.css');
8
+ @import url('components.css');
9
+ @import url('markdown.css');
10
+ @import url('code.css');
@@ -0,0 +1,199 @@
1
+ /* Markdown/Prose Styles */
2
+
3
+ /* Content area for markdown-rendered content */
4
+ .content {
5
+ color: var(--color-text);
6
+ }
7
+
8
+ /* Inline code */
9
+ .content code:not(.highlight code) {
10
+ padding: 0.2em 0.4em;
11
+ background-color: var(--color-code-bg);
12
+ color: var(--color-primary);
13
+ border-radius: var(--radius-sm);
14
+ font-size: 0.9em;
15
+ font-weight: var(--font-weight-medium);
16
+ border: 1px solid var(--color-border);
17
+ }
18
+
19
+ /* Lists */
20
+ .content ul,
21
+ .content ol {
22
+ margin: var(--space-4) 0;
23
+ padding-left: var(--space-6);
24
+ }
25
+
26
+ .content li {
27
+ margin: var(--space-2) 0;
28
+ }
29
+
30
+ .content li > ul,
31
+ .content li > ol {
32
+ margin: var(--space-2) 0;
33
+ }
34
+
35
+ /* Task lists (GitHub Flavored Markdown) */
36
+ .content ul.task-list {
37
+ list-style: none;
38
+ padding-left: 0;
39
+ }
40
+
41
+ .content ul.task-list li {
42
+ display: flex;
43
+ align-items: flex-start;
44
+ gap: var(--space-2);
45
+ }
46
+
47
+ .content ul.task-list input[type="checkbox"] {
48
+ margin-top: 0.25em;
49
+ flex-shrink: 0;
50
+ }
51
+
52
+ /* Blockquotes */
53
+ .content blockquote {
54
+ margin: var(--space-6) 0;
55
+ padding: var(--space-4);
56
+ padding-left: var(--space-5);
57
+ border-left: 3px solid var(--color-primary);
58
+ background-color: var(--color-bg-secondary);
59
+ border-radius: 0 var(--radius-md) var(--radius-md) 0;
60
+ color: var(--color-text-secondary);
61
+ }
62
+
63
+ .content blockquote p {
64
+ margin: var(--space-2) 0;
65
+ }
66
+
67
+ /* Horizontal rule */
68
+ .content hr {
69
+ margin: var(--space-8) 0;
70
+ border: none;
71
+ border-top: 1px solid var(--color-border);
72
+ }
73
+
74
+ /* Tables */
75
+ .content table {
76
+ width: 100%;
77
+ margin: var(--space-6) 0;
78
+ border-collapse: collapse;
79
+ font-size: var(--font-size-sm);
80
+ overflow: hidden;
81
+ border-radius: var(--radius-lg);
82
+ border: 1px solid var(--color-border);
83
+ box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.03);
84
+ }
85
+
86
+ .content thead {
87
+ background-color: var(--color-bg-secondary);
88
+ }
89
+
90
+ .content th {
91
+ padding: var(--space-3) var(--space-4);
92
+ text-align: left;
93
+ font-weight: var(--font-weight-semibold);
94
+ border-bottom: 1px solid var(--color-border);
95
+ color: var(--color-text);
96
+ }
97
+
98
+ .content td {
99
+ padding: var(--space-3) var(--space-4);
100
+ border-bottom: 1px solid var(--color-border-secondary);
101
+ }
102
+
103
+ .content tr:last-child td {
104
+ border-bottom: none;
105
+ }
106
+
107
+ .content tbody tr:hover {
108
+ background-color: var(--color-bg-secondary);
109
+ }
110
+
111
+ /* Images */
112
+ .content img {
113
+ max-width: 100%;
114
+ height: auto;
115
+ border-radius: var(--radius-lg);
116
+ margin: var(--space-6) 0;
117
+ box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
118
+ }
119
+
120
+ /* Links in content */
121
+ .content a {
122
+ color: var(--color-link);
123
+ text-decoration: underline;
124
+ text-decoration-color: var(--color-link);
125
+ text-decoration-thickness: 1px;
126
+ text-underline-offset: 2px;
127
+ transition: color var(--transition-fast);
128
+ }
129
+
130
+ .content a:hover {
131
+ color: var(--color-link-hover);
132
+ text-decoration-color: var(--color-link-hover);
133
+ }
134
+
135
+ /* Heading anchors */
136
+ .content h2[id],
137
+ .content h3[id],
138
+ .content h4[id],
139
+ .content h5[id],
140
+ .content h6[id] {
141
+ scroll-margin-top: var(--space-8);
142
+ }
143
+
144
+ /* Improve spacing between prose elements */
145
+ .content h2 + h3,
146
+ .content h3 + h4,
147
+ .content h4 + h5 {
148
+ margin-top: var(--space-4);
149
+ }
150
+
151
+ .content > *:first-child {
152
+ margin-top: 0;
153
+ }
154
+
155
+ .content > *:last-child {
156
+ margin-bottom: 0;
157
+ }
158
+
159
+ /* Definition lists */
160
+ .content dl {
161
+ margin: var(--space-4) 0;
162
+ }
163
+
164
+ .content dt {
165
+ font-weight: var(--font-weight-semibold);
166
+ margin-top: var(--space-4);
167
+ }
168
+
169
+ .content dd {
170
+ margin-left: var(--space-6);
171
+ margin-top: var(--space-2);
172
+ }
173
+
174
+ /* Keyboard */
175
+ .content kbd {
176
+ display: inline-block;
177
+ padding: 0.125em 0.375em;
178
+ font-family: var(--font-mono);
179
+ font-size: 0.875em;
180
+ color: var(--color-text);
181
+ background-color: var(--color-bg-secondary);
182
+ border: 1px solid var(--color-border);
183
+ border-radius: var(--radius-sm);
184
+ box-shadow: 0 1px 0 var(--color-border);
185
+ }
186
+
187
+ /* Mark/Highlight */
188
+ .content mark {
189
+ background-color: var(--color-warning-bg);
190
+ color: var(--color-text);
191
+ padding: 0.125em 0.25em;
192
+ border-radius: var(--radius-sm);
193
+ }
194
+
195
+ /* Abbreviations */
196
+ .content abbr {
197
+ text-decoration: underline dotted;
198
+ cursor: help;
199
+ }
@@ -0,0 +1,59 @@
1
+ /* Modern CSS Reset */
2
+ /* Based on https://piccalil.li/blog/a-more-modern-css-reset/ */
3
+
4
+ *,
5
+ *::before,
6
+ *::after {
7
+ box-sizing: border-box;
8
+ }
9
+
10
+ * {
11
+ margin: 0;
12
+ padding: 0;
13
+ }
14
+
15
+ html {
16
+ -webkit-font-smoothing: antialiased;
17
+ -moz-osx-font-smoothing: grayscale;
18
+ }
19
+
20
+ body {
21
+ min-height: 100vh;
22
+ line-height: 1.5;
23
+ }
24
+
25
+ img,
26
+ picture,
27
+ video,
28
+ canvas,
29
+ svg {
30
+ display: block;
31
+ max-width: 100%;
32
+ }
33
+
34
+ input,
35
+ button,
36
+ textarea,
37
+ select {
38
+ font: inherit;
39
+ }
40
+
41
+ p,
42
+ h1,
43
+ h2,
44
+ h3,
45
+ h4,
46
+ h5,
47
+ h6 {
48
+ overflow-wrap: break-word;
49
+ }
50
+
51
+ ul[role="list"],
52
+ ol[role="list"] {
53
+ list-style: none;
54
+ }
55
+
56
+ table {
57
+ border-collapse: collapse;
58
+ border-spacing: 0;
59
+ }
@@ -0,0 +1,97 @@
1
+ /* Base Typography */
2
+ body {
3
+ font-family: var(--font-sans);
4
+ font-size: var(--font-size-base);
5
+ line-height: var(--line-height-normal);
6
+ color: var(--color-text);
7
+ background-color: var(--color-bg);
8
+ -webkit-font-smoothing: antialiased;
9
+ -moz-osx-font-smoothing: grayscale;
10
+ }
11
+
12
+ /* Headings */
13
+ h1, h2, h3, h4, h5, h6 {
14
+ font-weight: var(--font-weight-semibold);
15
+ line-height: var(--line-height-tight);
16
+ color: var(--color-text);
17
+ }
18
+
19
+ h1 {
20
+ font-size: var(--font-size-4xl);
21
+ margin-bottom: var(--space-6);
22
+ }
23
+
24
+ h2 {
25
+ font-size: var(--font-size-3xl);
26
+ margin-top: var(--space-12);
27
+ margin-bottom: var(--space-4);
28
+ }
29
+
30
+ h3 {
31
+ font-size: var(--font-size-2xl);
32
+ margin-top: var(--space-10);
33
+ margin-bottom: var(--space-3);
34
+ }
35
+
36
+ h4 {
37
+ font-size: var(--font-size-xl);
38
+ margin-top: var(--space-8);
39
+ margin-bottom: var(--space-3);
40
+ }
41
+
42
+ h5 {
43
+ font-size: var(--font-size-lg);
44
+ margin-top: var(--space-6);
45
+ margin-bottom: var(--space-2);
46
+ }
47
+
48
+ h6 {
49
+ font-size: var(--font-size-base);
50
+ margin-top: var(--space-6);
51
+ margin-bottom: var(--space-2);
52
+ font-weight: var(--font-weight-semibold);
53
+ }
54
+
55
+ /* Paragraphs */
56
+ p {
57
+ margin-bottom: var(--space-4);
58
+ }
59
+
60
+ /* Links */
61
+ a {
62
+ color: var(--color-link);
63
+ text-decoration: none;
64
+ transition: color var(--transition-fast);
65
+ }
66
+
67
+ a:hover {
68
+ color: var(--color-link-hover);
69
+ text-decoration: underline;
70
+ }
71
+
72
+ a:focus-visible {
73
+ outline: 2px solid var(--color-primary);
74
+ outline-offset: 2px;
75
+ border-radius: var(--radius-sm);
76
+ }
77
+
78
+ /* Code */
79
+ code {
80
+ font-family: var(--font-mono);
81
+ font-size: 0.9em;
82
+ }
83
+
84
+ /* Small text */
85
+ small {
86
+ font-size: var(--font-size-sm);
87
+ color: var(--color-text-secondary);
88
+ }
89
+
90
+ /* Strong and emphasis */
91
+ strong, b {
92
+ font-weight: var(--font-weight-semibold);
93
+ }
94
+
95
+ em, i {
96
+ font-style: italic;
97
+ }