docyard 0.2.0 → 0.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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -1
  3. data/LICENSE.vscode-icons +42 -0
  4. data/README.md +46 -5
  5. data/lib/docyard/asset_handler.rb +33 -0
  6. data/lib/docyard/components/base_processor.rb +24 -0
  7. data/lib/docyard/components/callout_processor.rb +121 -0
  8. data/lib/docyard/components/code_block_processor.rb +55 -0
  9. data/lib/docyard/components/code_detector.rb +59 -0
  10. data/lib/docyard/components/icon_detector.rb +57 -0
  11. data/lib/docyard/components/icon_processor.rb +51 -0
  12. data/lib/docyard/components/registry.rb +34 -0
  13. data/lib/docyard/components/tabs_parser.rb +60 -0
  14. data/lib/docyard/components/tabs_processor.rb +44 -0
  15. data/lib/docyard/config/validator.rb +171 -0
  16. data/lib/docyard/config.rb +133 -0
  17. data/lib/docyard/constants.rb +5 -0
  18. data/lib/docyard/icons/LICENSE.phosphor +21 -0
  19. data/lib/docyard/icons/file_types.rb +92 -0
  20. data/lib/docyard/icons/phosphor.rb +63 -0
  21. data/lib/docyard/icons.rb +40 -0
  22. data/lib/docyard/initializer.rb +20 -2
  23. data/lib/docyard/language_mapping.rb +52 -0
  24. data/lib/docyard/markdown.rb +14 -3
  25. data/lib/docyard/rack_application.rb +76 -7
  26. data/lib/docyard/renderer.rb +40 -7
  27. data/lib/docyard/server.rb +5 -2
  28. data/lib/docyard/sidebar_builder.rb +10 -2
  29. data/lib/docyard/templates/assets/css/code.css +150 -2
  30. data/lib/docyard/templates/assets/css/components/callout.css +169 -0
  31. data/lib/docyard/templates/assets/css/components/code-block.css +196 -0
  32. data/lib/docyard/templates/assets/css/components/icon.css +16 -0
  33. data/lib/docyard/templates/assets/css/components/logo.css +44 -0
  34. data/lib/docyard/templates/assets/css/{components.css → components/navigation.css} +47 -47
  35. data/lib/docyard/templates/assets/css/components/tabs.css +298 -0
  36. data/lib/docyard/templates/assets/css/components/theme-toggle.css +61 -0
  37. data/lib/docyard/templates/assets/css/layout.css +14 -4
  38. data/lib/docyard/templates/assets/css/markdown.css +9 -8
  39. data/lib/docyard/templates/assets/css/reset.css +4 -0
  40. data/lib/docyard/templates/assets/css/variables.css +94 -3
  41. data/lib/docyard/templates/assets/favicon.svg +16 -0
  42. data/lib/docyard/templates/assets/js/components/code-block.js +162 -0
  43. data/lib/docyard/templates/assets/js/components/tabs.js +338 -0
  44. data/lib/docyard/templates/assets/js/theme.js +16 -0
  45. data/lib/docyard/templates/assets/logo-dark.svg +4 -0
  46. data/lib/docyard/templates/assets/logo.svg +12 -0
  47. data/lib/docyard/templates/config/docyard.yml.erb +20 -0
  48. data/lib/docyard/templates/layouts/default.html.erb +31 -3
  49. data/lib/docyard/templates/markdown/components/callouts.md.erb +204 -0
  50. data/lib/docyard/templates/markdown/components/icons.md.erb +125 -0
  51. data/lib/docyard/templates/markdown/components/tabs.md.erb +686 -0
  52. data/lib/docyard/templates/markdown/configuration.md.erb +202 -0
  53. data/lib/docyard/templates/partials/_callout.html.erb +11 -0
  54. data/lib/docyard/templates/partials/_code_block.html.erb +6 -0
  55. data/lib/docyard/templates/partials/_icon.html.erb +1 -0
  56. data/lib/docyard/templates/partials/_icon_file_extension.html.erb +1 -0
  57. data/lib/docyard/templates/partials/_tabs.html.erb +40 -0
  58. data/lib/docyard/templates/partials/_theme_toggle.html.erb +13 -0
  59. data/lib/docyard/version.rb +1 -1
  60. metadata +41 -2
@@ -0,0 +1,202 @@
1
+ ---
2
+ title: Configuration
3
+ ---
4
+
5
+ # Configuration
6
+
7
+ Docyard uses convention over configuration. You can start using Docyard without any configuration file - it just works!
8
+
9
+ ## Optional Configuration
10
+
11
+ Create a `docyard.yml` file in your project root to customize your documentation site.
12
+
13
+ ```yaml
14
+ site:
15
+ title: "My Documentation"
16
+ description: "Documentation for my project"
17
+
18
+ build:
19
+ output_dir: "dist"
20
+ base_url: "/"
21
+ ```
22
+
23
+ ## Configuration Reference
24
+
25
+ ### Site Settings
26
+
27
+ Configure your site metadata and branding.
28
+
29
+ #### `site.title`
30
+
31
+ The title of your documentation site. Shown in the browser tab and header.
32
+
33
+ - **Type:** String
34
+ - **Default:** `"Documentation"`
35
+
36
+ ```yaml
37
+ site:
38
+ title: "My Project Docs"
39
+ ```
40
+
41
+ #### `site.description`
42
+
43
+ Meta description for SEO and social sharing.
44
+
45
+ - **Type:** String
46
+ - **Default:** `""`
47
+
48
+ ```yaml
49
+ site:
50
+ description: "Complete documentation for My Project"
51
+ ```
52
+
53
+ #### `site.logo`
54
+
55
+ Path to your logo image. Displayed in the site header.
56
+
57
+ - **Type:** String (file path)
58
+ - **Default:** None
59
+ - **Supported formats:** SVG, PNG, JPG
60
+
61
+ ```yaml
62
+ site:
63
+ logo: "docs/assets/logo.svg"
64
+ ```
65
+
66
+ ::: tip
67
+ Use SVG format for your logo for best quality at all screen sizes.
68
+ :::
69
+
70
+ #### `site.logo_dark`
71
+
72
+ Optional dark mode variant of your logo.
73
+
74
+ - **Type:** String (file path)
75
+ - **Default:** None
76
+
77
+ ```yaml
78
+ site:
79
+ logo: "docs/assets/logo.svg"
80
+ logo_dark: "docs/assets/logo-dark.svg"
81
+ ```
82
+
83
+ #### `site.favicon`
84
+
85
+ Path to your favicon.
86
+
87
+ - **Type:** String (file path)
88
+ - **Default:** None
89
+ - **Supported formats:** `.ico`, `.png`
90
+
91
+ ```yaml
92
+ site:
93
+ favicon: "docs/assets/favicon.ico"
94
+ ```
95
+
96
+ ### Build Settings
97
+
98
+ Configure static site generation.
99
+
100
+ #### `build.output_dir`
101
+
102
+ Directory where the built site will be generated.
103
+
104
+ - **Type:** String
105
+ - **Default:** `"dist"`
106
+ - **Note:** Cannot contain slashes
107
+
108
+ ```yaml
109
+ build:
110
+ output_dir: "dist" # or "_site", "public", etc.
111
+ ```
112
+
113
+ #### `build.base_url`
114
+
115
+ Base URL for your site. Important for subdirectory deployments.
116
+
117
+ - **Type:** String
118
+ - **Default:** `"/"`
119
+ - **Note:** Must start with `/`
120
+
121
+ ```yaml
122
+ # For root deployment
123
+ build:
124
+ base_url: "/"
125
+
126
+ # For GitHub Pages project site
127
+ build:
128
+ base_url: "/my-repo/"
129
+ ```
130
+
131
+ ::: important
132
+ Set `base_url` correctly for subdirectory deployments (like GitHub Pages project sites) or your assets won't load correctly.
133
+ :::
134
+
135
+ #### `build.clean`
136
+
137
+ Whether to clean the output directory before building.
138
+
139
+ - **Type:** Boolean
140
+ - **Default:** `true`
141
+
142
+ ```yaml
143
+ build:
144
+ clean: true # Recommended
145
+ ```
146
+
147
+ ## Examples
148
+
149
+ ### Basic Configuration
150
+
151
+ Minimal config with just a custom title:
152
+
153
+ ```yaml
154
+ site:
155
+ title: "Acme Documentation"
156
+ ```
157
+
158
+ ### Full Branding
159
+
160
+ Complete branding with logo and favicon:
161
+
162
+ ```yaml
163
+ site:
164
+ title: "Acme Inc."
165
+ description: "API documentation for Acme services"
166
+ logo: "docs/assets/logo.svg"
167
+ logo_dark: "docs/assets/logo-dark.svg"
168
+ favicon: "docs/assets/favicon.ico"
169
+ ```
170
+
171
+ ### GitHub Pages Deployment
172
+
173
+ Configuration for GitHub Pages subdirectory:
174
+
175
+ ```yaml
176
+ site:
177
+ title: "My Project"
178
+
179
+ build:
180
+ base_url: "/my-repo/"
181
+ ```
182
+
183
+ ### Custom Output Directory
184
+
185
+ Using a different output directory:
186
+
187
+ ```yaml
188
+ build:
189
+ output_dir: "public"
190
+ base_url: "/"
191
+ ```
192
+
193
+ ## No Configuration Required
194
+
195
+ If you don't create a `docyard.yml` file, Docyard will work with sensible defaults:
196
+
197
+ - Site title: `"Documentation"`
198
+ - Output directory: `dist/`
199
+ - Base URL: `/`
200
+ - Clean build: `true`
201
+
202
+ This means you can run `docyard serve` immediately after `docyard init` without any additional configuration!
@@ -0,0 +1,11 @@
1
+ <div class="docyard-callout docyard-callout--<%= @type %>" role="<%= %w[danger warning].include?(@type) ? 'alert' : 'note' %>">
2
+ <div class="docyard-callout__icon" aria-hidden="true">
3
+ <%= @icon_svg %>
4
+ </div>
5
+ <div class="docyard-callout__content">
6
+ <div class="docyard-callout__title"><%= @title %></div>
7
+ <div class="docyard-callout__body">
8
+ <%= @content_html %>
9
+ </div>
10
+ </div>
11
+ </div>
@@ -0,0 +1,6 @@
1
+ <div class="docyard-code-block">
2
+ <%= @code_block_html %>
3
+ <button class="docyard-code-block__copy" aria-label="Copy code to clipboard" data-code="<%= @code_text %>">
4
+ <%= @copy_icon %>
5
+ </button>
6
+ </div>
@@ -0,0 +1 @@
1
+ <span class="docyard-icon docyard-icon-<%= @name %>" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><%= @icon_data %></svg></span>
@@ -0,0 +1 @@
1
+ <span class="docyard-icon docyard-icon-file-<%= @extension %>" aria-hidden="true"><%= @svg_content %></span>
@@ -0,0 +1,40 @@
1
+ <div class="docyard-tabs" data-tabs="<%= @group_id %>">
2
+ <div class="docyard-tabs__list-wrapper">
3
+ <div role="tablist" aria-label="Code examples" class="docyard-tabs__list">
4
+ <% @tabs.each_with_index do |tab, index| %>
5
+ <button
6
+ role="tab"
7
+ aria-selected="<%= index == 0 ? 'true' : 'false' %>"
8
+ aria-controls="tabpanel-<%= @group_id %>-<%= index %>"
9
+ id="tab-<%= @group_id %>-<%= index %>"
10
+ class="docyard-tabs__tab"
11
+ tabindex="<%= index == 0 ? '0' : '-1' %>"
12
+ >
13
+ <% if tab[:icon] %>
14
+ <span class="docyard-tabs__icon">
15
+ <% if tab[:icon_source] == "file-extension" %>
16
+ <%= Docyard::Icons.render_file_extension(tab[:icon]) %>
17
+ <% elsif tab[:icon_source] == "phosphor" %>
18
+ <%= Docyard::Icons.render(tab[:icon]) %>
19
+ <% end %>
20
+ </span>
21
+ <% end %>
22
+ <%= tab[:name] %>
23
+ </button>
24
+ <% end %>
25
+ <div class="docyard-tabs__indicator" aria-hidden="true"></div>
26
+ </div>
27
+ </div>
28
+ <% @tabs.each_with_index do |tab, index| %>
29
+ <div
30
+ role="tabpanel"
31
+ id="tabpanel-<%= @group_id %>-<%= index %>"
32
+ aria-labelledby="tab-<%= @group_id %>-<%= index %>"
33
+ aria-hidden="<%= index == 0 ? 'false' : 'true' %>"
34
+ class="docyard-tabs__panel"
35
+ tabindex="0"
36
+ >
37
+ <%= tab[:content] %>
38
+ </div>
39
+ <% end %>
40
+ </div>
@@ -0,0 +1,13 @@
1
+ <button class="theme-toggle" aria-label="Toggle theme" title="Toggle theme">
2
+ <span class="theme-toggle-track">
3
+ <!-- Sun icon -->
4
+ <svg class="theme-toggle-icon theme-toggle-sun-icon" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 256 256" fill="currentColor">
5
+ <path d="M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z"></path>
6
+ </svg>
7
+ <!-- Moon stars icon -->
8
+ <svg class="theme-toggle-icon theme-toggle-moon-icon" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 256 256" fill="currentColor">
9
+ <path d="M240,96a8,8,0,0,1-8,8H216v16a8,8,0,0,1-16,0V104H184a8,8,0,0,1,0-16h16V72a8,8,0,0,1,16,0V88h16A8,8,0,0,1,240,96ZM144,56h8v8a8,8,0,0,0,16,0V56h8a8,8,0,0,0,0-16h-8V32a8,8,0,0,0-16,0v8h-8a8,8,0,0,0,0,16Zm72.77,97a8,8,0,0,1,1.43,8A96,96,0,1,1,95.07,37.8a8,8,0,0,1,10.6,9.06A88.07,88.07,0,0,0,209.14,150.33,8,8,0,0,1,216.77,153Zm-19.39,14.88c-1.79.09-3.59.14-5.38.14A104.11,104.11,0,0,1,88,64c0-1.79,0-3.59.14-5.38A80,80,0,1,0,197.38,167.86Z"></path>
10
+ </svg>
11
+ <span class="theme-toggle-thumb"></span>
12
+ </span>
13
+ </button>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Docyard
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docyard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sanif Himani
@@ -137,15 +137,32 @@ files:
137
137
  - CODE_OF_CONDUCT.md
138
138
  - CONTRIBUTING.md
139
139
  - LICENSE.txt
140
+ - LICENSE.vscode-icons
140
141
  - README.md
141
142
  - Rakefile
142
143
  - lib/docyard.rb
143
144
  - lib/docyard/asset_handler.rb
144
145
  - lib/docyard/cli.rb
146
+ - lib/docyard/components/base_processor.rb
147
+ - lib/docyard/components/callout_processor.rb
148
+ - lib/docyard/components/code_block_processor.rb
149
+ - lib/docyard/components/code_detector.rb
150
+ - lib/docyard/components/icon_detector.rb
151
+ - lib/docyard/components/icon_processor.rb
152
+ - lib/docyard/components/registry.rb
153
+ - lib/docyard/components/tabs_parser.rb
154
+ - lib/docyard/components/tabs_processor.rb
155
+ - lib/docyard/config.rb
156
+ - lib/docyard/config/validator.rb
145
157
  - lib/docyard/constants.rb
146
158
  - lib/docyard/errors.rb
147
159
  - lib/docyard/file_watcher.rb
160
+ - lib/docyard/icons.rb
161
+ - lib/docyard/icons/LICENSE.phosphor
162
+ - lib/docyard/icons/file_types.rb
163
+ - lib/docyard/icons/phosphor.rb
148
164
  - lib/docyard/initializer.rb
165
+ - lib/docyard/language_mapping.rb
149
166
  - lib/docyard/logging.rb
150
167
  - lib/docyard/markdown.rb
151
168
  - lib/docyard/rack_application.rb
@@ -159,24 +176,44 @@ files:
159
176
  - lib/docyard/sidebar/tree_builder.rb
160
177
  - lib/docyard/sidebar_builder.rb
161
178
  - lib/docyard/templates/assets/css/code.css
162
- - lib/docyard/templates/assets/css/components.css
179
+ - lib/docyard/templates/assets/css/components/callout.css
180
+ - lib/docyard/templates/assets/css/components/code-block.css
181
+ - lib/docyard/templates/assets/css/components/icon.css
182
+ - lib/docyard/templates/assets/css/components/logo.css
183
+ - lib/docyard/templates/assets/css/components/navigation.css
184
+ - lib/docyard/templates/assets/css/components/tabs.css
185
+ - lib/docyard/templates/assets/css/components/theme-toggle.css
163
186
  - lib/docyard/templates/assets/css/layout.css
164
187
  - lib/docyard/templates/assets/css/main.css
165
188
  - lib/docyard/templates/assets/css/markdown.css
166
189
  - lib/docyard/templates/assets/css/reset.css
167
190
  - lib/docyard/templates/assets/css/typography.css
168
191
  - lib/docyard/templates/assets/css/variables.css
192
+ - lib/docyard/templates/assets/favicon.svg
193
+ - lib/docyard/templates/assets/js/components/code-block.js
194
+ - lib/docyard/templates/assets/js/components/tabs.js
169
195
  - lib/docyard/templates/assets/js/reload.js
170
196
  - lib/docyard/templates/assets/js/theme.js
197
+ - lib/docyard/templates/assets/logo-dark.svg
198
+ - lib/docyard/templates/assets/logo.svg
199
+ - lib/docyard/templates/config/docyard.yml.erb
171
200
  - lib/docyard/templates/errors/404.html.erb
172
201
  - lib/docyard/templates/errors/500.html.erb
173
202
  - lib/docyard/templates/layouts/default.html.erb
203
+ - lib/docyard/templates/markdown/components/callouts.md.erb
204
+ - lib/docyard/templates/markdown/components/icons.md.erb
205
+ - lib/docyard/templates/markdown/components/tabs.md.erb
206
+ - lib/docyard/templates/markdown/configuration.md.erb
174
207
  - lib/docyard/templates/markdown/core-concepts/file-structure.md.erb
175
208
  - lib/docyard/templates/markdown/core-concepts/markdown.md.erb
176
209
  - lib/docyard/templates/markdown/getting-started/installation.md.erb
177
210
  - lib/docyard/templates/markdown/getting-started/introduction.md.erb
178
211
  - lib/docyard/templates/markdown/getting-started/quick-start.md.erb
179
212
  - lib/docyard/templates/markdown/index.md.erb
213
+ - lib/docyard/templates/partials/_callout.html.erb
214
+ - lib/docyard/templates/partials/_code_block.html.erb
215
+ - lib/docyard/templates/partials/_icon.html.erb
216
+ - lib/docyard/templates/partials/_icon_file_extension.html.erb
180
217
  - lib/docyard/templates/partials/_icons.html.erb
181
218
  - lib/docyard/templates/partials/_nav_group.html.erb
182
219
  - lib/docyard/templates/partials/_nav_item.html.erb
@@ -185,6 +222,8 @@ files:
185
222
  - lib/docyard/templates/partials/_nav_section.html.erb
186
223
  - lib/docyard/templates/partials/_sidebar.html.erb
187
224
  - lib/docyard/templates/partials/_sidebar_footer.html.erb
225
+ - lib/docyard/templates/partials/_tabs.html.erb
226
+ - lib/docyard/templates/partials/_theme_toggle.html.erb
188
227
  - lib/docyard/utils/path_resolver.rb
189
228
  - lib/docyard/utils/text_formatter.rb
190
229
  - lib/docyard/version.rb