docyard 0.3.0 → 0.5.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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +32 -2
  3. data/README.md +80 -33
  4. data/lib/docyard/build/asset_bundler.rb +139 -0
  5. data/lib/docyard/build/file_copier.rb +105 -0
  6. data/lib/docyard/build/sitemap_generator.rb +57 -0
  7. data/lib/docyard/build/static_generator.rb +141 -0
  8. data/lib/docyard/builder.rb +104 -0
  9. data/lib/docyard/cli.rb +19 -0
  10. data/lib/docyard/components/heading_anchor_processor.rb +34 -0
  11. data/lib/docyard/components/table_of_contents_processor.rb +64 -0
  12. data/lib/docyard/components/table_wrapper_processor.rb +18 -0
  13. data/lib/docyard/config.rb +15 -2
  14. data/lib/docyard/icons/phosphor.rb +3 -1
  15. data/lib/docyard/initializer.rb +80 -14
  16. data/lib/docyard/markdown.rb +19 -0
  17. data/lib/docyard/prev_next_builder.rb +159 -0
  18. data/lib/docyard/preview_server.rb +72 -0
  19. data/lib/docyard/rack_application.rb +25 -3
  20. data/lib/docyard/renderer.rb +33 -8
  21. data/lib/docyard/sidebar/config_parser.rb +180 -0
  22. data/lib/docyard/sidebar/item.rb +58 -0
  23. data/lib/docyard/sidebar/renderer.rb +33 -6
  24. data/lib/docyard/sidebar_builder.rb +45 -1
  25. data/lib/docyard/templates/assets/css/components/callout.css +1 -1
  26. data/lib/docyard/templates/assets/css/components/code-block.css +2 -2
  27. data/lib/docyard/templates/assets/css/components/heading-anchor.css +77 -0
  28. data/lib/docyard/templates/assets/css/components/navigation.css +65 -7
  29. data/lib/docyard/templates/assets/css/components/prev-next.css +114 -0
  30. data/lib/docyard/templates/assets/css/components/table-of-contents.css +269 -0
  31. data/lib/docyard/templates/assets/css/components/tabs.css +3 -2
  32. data/lib/docyard/templates/assets/css/components/theme-toggle.css +8 -0
  33. data/lib/docyard/templates/assets/css/layout.css +58 -1
  34. data/lib/docyard/templates/assets/css/markdown.css +20 -11
  35. data/lib/docyard/templates/assets/css/variables.css +1 -0
  36. data/lib/docyard/templates/assets/js/components/heading-anchor.js +90 -0
  37. data/lib/docyard/templates/assets/js/components/navigation.js +225 -0
  38. data/lib/docyard/templates/assets/js/components/table-of-contents.js +301 -0
  39. data/lib/docyard/templates/assets/js/theme.js +2 -185
  40. data/lib/docyard/templates/config/docyard.yml.erb +32 -10
  41. data/lib/docyard/templates/layouts/default.html.erb +10 -2
  42. data/lib/docyard/templates/markdown/getting-started/installation.md.erb +46 -12
  43. data/lib/docyard/templates/markdown/guides/configuration.md.erb +202 -0
  44. data/lib/docyard/templates/markdown/guides/markdown-features.md.erb +247 -0
  45. data/lib/docyard/templates/markdown/index.md.erb +55 -59
  46. data/lib/docyard/templates/partials/_heading_anchor.html.erb +1 -0
  47. data/lib/docyard/templates/partials/_nav_group.html.erb +10 -4
  48. data/lib/docyard/templates/partials/_nav_leaf.html.erb +9 -1
  49. data/lib/docyard/templates/partials/_prev_next.html.erb +23 -0
  50. data/lib/docyard/templates/partials/_table_of_contents.html.erb +45 -0
  51. data/lib/docyard/templates/partials/_table_of_contents_toggle.html.erb +8 -0
  52. data/lib/docyard/version.rb +1 -1
  53. data/lib/docyard.rb +8 -0
  54. metadata +67 -10
  55. data/lib/docyard/templates/markdown/components/callouts.md.erb +0 -204
  56. data/lib/docyard/templates/markdown/components/icons.md.erb +0 -125
  57. data/lib/docyard/templates/markdown/components/tabs.md.erb +0 -686
  58. data/lib/docyard/templates/markdown/configuration.md.erb +0 -202
  59. data/lib/docyard/templates/markdown/core-concepts/file-structure.md.erb +0 -61
  60. data/lib/docyard/templates/markdown/core-concepts/markdown.md.erb +0 -90
  61. data/lib/docyard/templates/markdown/getting-started/introduction.md.erb +0 -30
  62. data/lib/docyard/templates/markdown/getting-started/quick-start.md.erb +0 -56
  63. data/lib/docyard/templates/partials/_icons.html.erb +0 -11
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.3.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sanif Himani
@@ -9,6 +9,20 @@ bindir: exe
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: cssminify
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '1.0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '1.0'
12
26
  - !ruby/object:Gem::Dependency
13
27
  name: kramdown
14
28
  requirement: !ruby/object:Gem::Requirement
@@ -93,6 +107,20 @@ dependencies:
93
107
  - - "~>"
94
108
  - !ruby/object:Gem::Version
95
109
  version: '4.0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: terser
112
+ requirement: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '1.2'
117
+ type: :runtime
118
+ prerelease: false
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '1.2'
96
124
  - !ruby/object:Gem::Dependency
97
125
  name: thor
98
126
  requirement: !ruby/object:Gem::Requirement
@@ -107,6 +135,20 @@ dependencies:
107
135
  - - "~>"
108
136
  - !ruby/object:Gem::Version
109
137
  version: '1.4'
138
+ - !ruby/object:Gem::Dependency
139
+ name: tty-progressbar
140
+ requirement: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: '0.18'
145
+ type: :runtime
146
+ prerelease: false
147
+ version_requirements: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - "~>"
150
+ - !ruby/object:Gem::Version
151
+ version: '0.18'
110
152
  - !ruby/object:Gem::Dependency
111
153
  name: webrick
112
154
  requirement: !ruby/object:Gem::Requirement
@@ -142,14 +184,22 @@ files:
142
184
  - Rakefile
143
185
  - lib/docyard.rb
144
186
  - lib/docyard/asset_handler.rb
187
+ - lib/docyard/build/asset_bundler.rb
188
+ - lib/docyard/build/file_copier.rb
189
+ - lib/docyard/build/sitemap_generator.rb
190
+ - lib/docyard/build/static_generator.rb
191
+ - lib/docyard/builder.rb
145
192
  - lib/docyard/cli.rb
146
193
  - lib/docyard/components/base_processor.rb
147
194
  - lib/docyard/components/callout_processor.rb
148
195
  - lib/docyard/components/code_block_processor.rb
149
196
  - lib/docyard/components/code_detector.rb
197
+ - lib/docyard/components/heading_anchor_processor.rb
150
198
  - lib/docyard/components/icon_detector.rb
151
199
  - lib/docyard/components/icon_processor.rb
152
200
  - lib/docyard/components/registry.rb
201
+ - lib/docyard/components/table_of_contents_processor.rb
202
+ - lib/docyard/components/table_wrapper_processor.rb
153
203
  - lib/docyard/components/tabs_parser.rb
154
204
  - lib/docyard/components/tabs_processor.rb
155
205
  - lib/docyard/config.rb
@@ -165,12 +215,16 @@ files:
165
215
  - lib/docyard/language_mapping.rb
166
216
  - lib/docyard/logging.rb
167
217
  - lib/docyard/markdown.rb
218
+ - lib/docyard/prev_next_builder.rb
219
+ - lib/docyard/preview_server.rb
168
220
  - lib/docyard/rack_application.rb
169
221
  - lib/docyard/renderer.rb
170
222
  - lib/docyard/router.rb
171
223
  - lib/docyard/routing/resolution_result.rb
172
224
  - lib/docyard/server.rb
225
+ - lib/docyard/sidebar/config_parser.rb
173
226
  - lib/docyard/sidebar/file_system_scanner.rb
227
+ - lib/docyard/sidebar/item.rb
174
228
  - lib/docyard/sidebar/renderer.rb
175
229
  - lib/docyard/sidebar/title_extractor.rb
176
230
  - lib/docyard/sidebar/tree_builder.rb
@@ -178,9 +232,12 @@ files:
178
232
  - lib/docyard/templates/assets/css/code.css
179
233
  - lib/docyard/templates/assets/css/components/callout.css
180
234
  - lib/docyard/templates/assets/css/components/code-block.css
235
+ - lib/docyard/templates/assets/css/components/heading-anchor.css
181
236
  - lib/docyard/templates/assets/css/components/icon.css
182
237
  - lib/docyard/templates/assets/css/components/logo.css
183
238
  - lib/docyard/templates/assets/css/components/navigation.css
239
+ - lib/docyard/templates/assets/css/components/prev-next.css
240
+ - lib/docyard/templates/assets/css/components/table-of-contents.css
184
241
  - lib/docyard/templates/assets/css/components/tabs.css
185
242
  - lib/docyard/templates/assets/css/components/theme-toggle.css
186
243
  - lib/docyard/templates/assets/css/layout.css
@@ -191,6 +248,9 @@ files:
191
248
  - lib/docyard/templates/assets/css/variables.css
192
249
  - lib/docyard/templates/assets/favicon.svg
193
250
  - lib/docyard/templates/assets/js/components/code-block.js
251
+ - lib/docyard/templates/assets/js/components/heading-anchor.js
252
+ - lib/docyard/templates/assets/js/components/navigation.js
253
+ - lib/docyard/templates/assets/js/components/table-of-contents.js
194
254
  - lib/docyard/templates/assets/js/components/tabs.js
195
255
  - lib/docyard/templates/assets/js/reload.js
196
256
  - lib/docyard/templates/assets/js/theme.js
@@ -200,28 +260,25 @@ files:
200
260
  - lib/docyard/templates/errors/404.html.erb
201
261
  - lib/docyard/templates/errors/500.html.erb
202
262
  - 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
207
- - lib/docyard/templates/markdown/core-concepts/file-structure.md.erb
208
- - lib/docyard/templates/markdown/core-concepts/markdown.md.erb
209
263
  - lib/docyard/templates/markdown/getting-started/installation.md.erb
210
- - lib/docyard/templates/markdown/getting-started/introduction.md.erb
211
- - lib/docyard/templates/markdown/getting-started/quick-start.md.erb
264
+ - lib/docyard/templates/markdown/guides/configuration.md.erb
265
+ - lib/docyard/templates/markdown/guides/markdown-features.md.erb
212
266
  - lib/docyard/templates/markdown/index.md.erb
213
267
  - lib/docyard/templates/partials/_callout.html.erb
214
268
  - lib/docyard/templates/partials/_code_block.html.erb
269
+ - lib/docyard/templates/partials/_heading_anchor.html.erb
215
270
  - lib/docyard/templates/partials/_icon.html.erb
216
271
  - lib/docyard/templates/partials/_icon_file_extension.html.erb
217
- - lib/docyard/templates/partials/_icons.html.erb
218
272
  - lib/docyard/templates/partials/_nav_group.html.erb
219
273
  - lib/docyard/templates/partials/_nav_item.html.erb
220
274
  - lib/docyard/templates/partials/_nav_leaf.html.erb
221
275
  - lib/docyard/templates/partials/_nav_list.html.erb
222
276
  - lib/docyard/templates/partials/_nav_section.html.erb
277
+ - lib/docyard/templates/partials/_prev_next.html.erb
223
278
  - lib/docyard/templates/partials/_sidebar.html.erb
224
279
  - lib/docyard/templates/partials/_sidebar_footer.html.erb
280
+ - lib/docyard/templates/partials/_table_of_contents.html.erb
281
+ - lib/docyard/templates/partials/_table_of_contents_toggle.html.erb
225
282
  - lib/docyard/templates/partials/_tabs.html.erb
226
283
  - lib/docyard/templates/partials/_theme_toggle.html.erb
227
284
  - lib/docyard/utils/path_resolver.rb
@@ -1,204 +0,0 @@
1
- # Callouts
2
-
3
- Docyard supports beautiful callouts (also known as admonitions) to highlight important information in your documentation. Callouts support both VitePress-style syntax and GitHub-style alerts.
4
-
5
- ## Callout Types
6
-
7
- There are 5 callout types, each with a distinct color and icon:
8
-
9
- ### Note (Blue)
10
-
11
- Use **note** callouts for neutral, informational content that provides additional context.
12
-
13
- ::: note
14
- This is a note callout with the default title.
15
- :::
16
-
17
- ::: note Custom Title
18
- You can customize the title of any callout type.
19
- :::
20
-
21
- ### Tip (Green)
22
-
23
- Use **tip** callouts for helpful advice, best practices, or pro tips.
24
-
25
- ::: tip
26
- This is a helpful tip to improve your documentation.
27
- :::
28
-
29
- ::: tip Best Practice
30
- Always include callouts to make important information stand out!
31
- :::
32
-
33
- ### Important (Purple)
34
-
35
- Use **important** callouts for crucial information that requires special attention.
36
-
37
- ::: important
38
- This information is important and should not be overlooked.
39
- :::
40
-
41
- ::: important Critical Information
42
- Pay special attention to this section of the documentation.
43
- :::
44
-
45
- ### Warning (Orange)
46
-
47
- Use **warning** callouts when users need to be careful or aware of potential issues.
48
-
49
- ::: warning
50
- Be careful when following these instructions as they may affect your system.
51
- :::
52
-
53
- ::: warning Potential Issues
54
- Make sure to backup your data before proceeding with this operation.
55
- :::
56
-
57
- ### Danger (Red)
58
-
59
- Use **danger** callouts for critical warnings about dangerous operations or severe consequences.
60
-
61
- ::: danger
62
- This operation is dangerous and may result in data loss. Proceed with extreme caution.
63
- :::
64
-
65
- ::: danger Do Not Do This
66
- Never run this command in production without thorough testing!
67
- :::
68
-
69
- ## GitHub-Style Alerts
70
-
71
- Docyard also supports GitHub-style alert syntax for compatibility with existing documentation.
72
-
73
- > [!NOTE]
74
- > This is a GitHub-style note alert. It renders exactly the same as the VitePress syntax.
75
-
76
- > [!TIP]
77
- > GitHub alerts are automatically converted to beautifully styled callouts!
78
-
79
- > [!IMPORTANT]
80
- > You can use either syntax - both produce the same visual result.
81
-
82
- > [!WARNING]
83
- > GitHub-style warnings work just like VitePress warnings.
84
-
85
- > [!CAUTION]
86
- > The CAUTION type maps to the danger callout style.
87
-
88
- ## Rich Content Support
89
-
90
- Callouts support all markdown features, making them extremely versatile.
91
-
92
- ### Inline Formatting
93
-
94
- ::: note
95
- Callouts support **bold text**, *italic text*, `inline code`, and [links](https://github.com).
96
- :::
97
-
98
- ### Lists
99
-
100
- ::: tip Key Features
101
- Here are the main benefits of using callouts:
102
-
103
- - Improved readability
104
- - Visual hierarchy
105
- - Better user engagement
106
- - Accessible design with ARIA roles
107
- - Dark mode support
108
- :::
109
-
110
- ### Code Blocks
111
-
112
- ::: important
113
- You can include code examples inside callouts:
114
-
115
- ```ruby
116
- class Docyard::CalloutProcessor
117
- def self.preprocess(markdown)
118
- # Process callout syntax
119
- end
120
- end
121
- ```
122
-
123
- The code will be syntax-highlighted just like regular code blocks.
124
- :::
125
-
126
- ### Multi-Paragraph Content
127
-
128
- ::: warning
129
- This callout contains multiple paragraphs to demonstrate complex content.
130
-
131
- Each paragraph is properly spaced and rendered. You can include as much content as you need.
132
-
133
- You can even mix paragraphs with other elements like lists or code blocks.
134
- :::
135
-
136
- ### Nested Content
137
-
138
- ::: tip Advanced Usage
139
- Callouts can contain complex nested structures:
140
-
141
- 1. **First step**: Install Docyard
142
- ```bash
143
- gem install docyard
144
- ```
145
-
146
- 2. **Second step**: Initialize your project
147
- ```bash
148
- docyard init my-docs
149
- ```
150
-
151
- 3. **Third step**: Start the development server
152
- ```bash
153
- docyard serve
154
- ```
155
-
156
- And you're ready to go!
157
- :::
158
-
159
- ## Multiple Callouts
160
-
161
- You can use multiple callouts in sequence to create rich, informative documentation:
162
-
163
- ::: note Prerequisites
164
- Before starting this tutorial, make sure you have Ruby 3.0+ installed.
165
- :::
166
-
167
- ::: tip
168
- Use `ruby --version` to check your Ruby version.
169
- :::
170
-
171
- ::: warning
172
- If you're using a Ruby version older than 3.0, some features may not work correctly.
173
- :::
174
-
175
- ## Accessibility
176
-
177
- All callouts include proper ARIA roles for screen readers:
178
-
179
- - Note, Tip, and Important callouts use `role="note"`
180
- - Warning and Danger callouts use `role="alert"` for higher priority
181
-
182
- ## Dark Mode
183
-
184
- Callouts automatically adapt to dark mode with enhanced colors and subtle glow effects for better visibility.
185
-
186
- ## Comparison Table
187
-
188
- | Callout Type | Color | Icon | When to Use |
189
- |--------------|--------|-----------------|--------------------------------------|
190
- | Note | Blue | Info | General information, context |
191
- | Tip | Green | Lightbulb | Helpful advice, best practices |
192
- | Important | Purple | Warning Circle | Critical information, key points |
193
- | Warning | Orange | Warning | Caution, potential issues |
194
- | Danger | Red | Siren | Severe warnings, dangerous operations|
195
-
196
- ## Examples in Action
197
-
198
- ::: note Documentation Tip
199
- Throughout the Docyard documentation, you'll see callouts used to highlight key information, provide helpful tips, and warn about potential issues.
200
- :::
201
-
202
- ::: tip
203
- Try creating your own callouts in your documentation to see how they improve readability and user engagement!
204
- :::
@@ -1,125 +0,0 @@
1
- # Icons
2
-
3
- Docyard includes 24 essential Phosphor icons that work seamlessly in your markdown. Icons automatically match your text size and inherit colors from the surrounding content.
4
-
5
- ## Basic Usage
6
-
7
- Simply type `:icon-name:` anywhere in your markdown:
8
-
9
- ```markdown
10
- :check: Task completed
11
- :warning: Important note
12
- :rocket-launch: Ready to launch
13
- ```
14
-
15
- Result:
16
-
17
- :check: Task completed
18
-
19
- :warning: Important note
20
-
21
- :rocket-launch: Ready to launch
22
-
23
- ## Icon Weights
24
-
25
- Phosphor icons come in 6 different weights. Specify the weight after the icon name:
26
-
27
- ```markdown
28
- :heart: Regular (default)
29
- :heart:bold: Bold weight
30
- :heart:fill: Filled version
31
- :heart:light: Light weight
32
- :heart:thin: Thin weight
33
- :heart:duotone: Duotone style
34
- ```
35
-
36
- Result:
37
-
38
- :heart: Regular · :heart:bold: Bold · :heart:fill: Fill · :heart:light: Light · :heart:thin: Thin · :heart:duotone: Duotone
39
-
40
- ## Common Use Cases
41
-
42
- ### Feature Lists
43
-
44
- ```markdown
45
- :check: Zero configuration
46
- :lightning: Hot reload
47
- :code: Syntax highlighting
48
- :moon-stars: Dark mode support
49
- :package: Ruby-native
50
- ```
51
-
52
- :check: Zero configuration
53
-
54
- :lightning: Hot reload
55
-
56
- :code: Syntax highlighting
57
-
58
- :moon-stars: Dark mode support
59
-
60
- :package: Ruby-native
61
-
62
- ### Callouts and Alerts
63
-
64
- ```markdown
65
- :warning: **Warning:** Make sure to back up your data first.
66
-
67
- :info: **Tip:** You can combine icons with any markdown formatting.
68
-
69
- :x: **Error:** Connection failed. Please try again.
70
- ```
71
-
72
- :warning: **Warning:** Make sure to back up your data first.
73
-
74
- :info: **Tip:** You can combine icons with any markdown formatting.
75
-
76
- :x: **Error:** Connection failed. Please try again.
77
-
78
- ### Navigation and Links
79
-
80
- ```markdown
81
- :arrow-right: [Next: File Structure](file-structure)
82
- :arrow-left: [Previous: Installation](../getting-started/installation)
83
- :link-external: [View on GitHub](https://github.com)
84
- ```
85
-
86
- :arrow-right: [Next: File Structure](file-structure)
87
-
88
- :arrow-left: [Previous: Installation](../getting-started/installation)
89
-
90
- :link-external: [View on GitHub](https://github.com)
91
-
92
- ## Available Icons
93
-
94
- ### UI & Actions
95
- :check: `check` · :x: `x` · :warning: `warning` · :info: `info` · :question: `question` · :copy: `copy`
96
-
97
- ### Arrows & Navigation
98
- :arrow-right: `arrow-right` · :arrow-left: `arrow-left` · :arrow-up: `arrow-up` · :arrow-down: `arrow-down`
99
-
100
- ### Development
101
- :code: `code` · :terminal: `terminal` · :package: `package` · :github: `github`
102
-
103
- ### General
104
- :heart: `heart` · :star: `star` · :rocket-launch: `rocket-launch` · :lightning: `lightning`
105
-
106
- ### Theme
107
- :sun: `sun` · :moon-stars: `moon-stars`
108
-
109
- ### Links
110
- :link-external: `link-external`
111
-
112
- ## Tips
113
-
114
- 1. **Size Matching**: Icons automatically scale to match surrounding text size (headings, paragraphs, etc.)
115
- 2. **Color Inheritance**: Icons use `currentColor`, so they inherit text color from parent elements
116
- 3. **Unknown Icons**: If an icon doesn't exist, the `:icon-name:` syntax stays as plain text
117
- 4. **Code Blocks**: Icon syntax inside code blocks won't be processed (as expected)
118
-
119
- ## More Icons
120
-
121
- Docyard ships with 24 essential icons by default, each available in 6 weights (regular, bold, fill, light, thin, duotone). The full Phosphor icon set includes 1000+ icons at [phosphoricons.com](https://phosphoricons.com), but Docyard includes only the most commonly needed icons to keep the gem lightweight.
122
-
123
- ## Attribution
124
-
125
- Icons provided by [Phosphor Icons](https://phosphoricons.com) under the MIT License.