docyard 0.3.0 → 0.4.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 (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -1
  3. data/README.md +55 -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/table_wrapper_processor.rb +18 -0
  11. data/lib/docyard/config.rb +4 -2
  12. data/lib/docyard/icons/phosphor.rb +1 -0
  13. data/lib/docyard/initializer.rb +80 -14
  14. data/lib/docyard/markdown.rb +13 -0
  15. data/lib/docyard/preview_server.rb +72 -0
  16. data/lib/docyard/rack_application.rb +1 -1
  17. data/lib/docyard/renderer.rb +17 -3
  18. data/lib/docyard/sidebar/config_parser.rb +180 -0
  19. data/lib/docyard/sidebar/item.rb +58 -0
  20. data/lib/docyard/sidebar/renderer.rb +33 -6
  21. data/lib/docyard/sidebar_builder.rb +45 -1
  22. data/lib/docyard/templates/assets/css/components/callout.css +1 -1
  23. data/lib/docyard/templates/assets/css/components/code-block.css +2 -2
  24. data/lib/docyard/templates/assets/css/components/navigation.css +65 -7
  25. data/lib/docyard/templates/assets/css/components/tabs.css +3 -2
  26. data/lib/docyard/templates/assets/css/components/theme-toggle.css +8 -0
  27. data/lib/docyard/templates/assets/css/markdown.css +20 -11
  28. data/lib/docyard/templates/assets/js/components/navigation.js +221 -0
  29. data/lib/docyard/templates/assets/js/theme.js +2 -185
  30. data/lib/docyard/templates/config/docyard.yml.erb +32 -10
  31. data/lib/docyard/templates/layouts/default.html.erb +1 -1
  32. data/lib/docyard/templates/markdown/getting-started/installation.md.erb +46 -12
  33. data/lib/docyard/templates/markdown/guides/configuration.md.erb +202 -0
  34. data/lib/docyard/templates/markdown/guides/markdown-features.md.erb +247 -0
  35. data/lib/docyard/templates/markdown/index.md.erb +55 -59
  36. data/lib/docyard/templates/partials/_nav_group.html.erb +10 -4
  37. data/lib/docyard/templates/partials/_nav_leaf.html.erb +9 -1
  38. data/lib/docyard/version.rb +1 -1
  39. data/lib/docyard.rb +8 -0
  40. metadata +55 -10
  41. data/lib/docyard/templates/markdown/components/callouts.md.erb +0 -204
  42. data/lib/docyard/templates/markdown/components/icons.md.erb +0 -125
  43. data/lib/docyard/templates/markdown/components/tabs.md.erb +0 -686
  44. data/lib/docyard/templates/markdown/configuration.md.erb +0 -202
  45. data/lib/docyard/templates/markdown/core-concepts/file-structure.md.erb +0 -61
  46. data/lib/docyard/templates/markdown/core-concepts/markdown.md.erb +0 -90
  47. data/lib/docyard/templates/markdown/getting-started/introduction.md.erb +0 -30
  48. data/lib/docyard/templates/markdown/getting-started/quick-start.md.erb +0 -56
  49. data/lib/docyard/templates/partials/_icons.html.erb +0 -11
@@ -0,0 +1,247 @@
1
+ # Markdown Features
2
+
3
+ Docyard supports GitHub Flavored Markdown (GFM) plus powerful custom components.
4
+
5
+ ## Basic Formatting
6
+
7
+ Use standard markdown syntax for formatting:
8
+
9
+ **Bold text** with `**bold**` or `__bold__`
10
+
11
+ *Italic text* with `*italic*` or `_italic_`
12
+
13
+ `Inline code` with \`backticks\`
14
+
15
+ ~~Strikethrough~~ with `~~text~~`
16
+
17
+ ## Headings
18
+
19
+ ```markdown
20
+ # H1 Heading
21
+ ## H2 Heading
22
+ ### H3 Heading
23
+ #### H4 Heading
24
+ ```
25
+
26
+ ## Lists
27
+
28
+ Unordered lists:
29
+
30
+ - Item one
31
+ - Item two
32
+ - Nested item
33
+ - Another nested item
34
+ - Item three
35
+
36
+ Ordered lists:
37
+
38
+ 1. First step
39
+ 2. Second step
40
+ 3. Third step
41
+
42
+ Task lists:
43
+
44
+ - [x] Completed task
45
+ - [ ] Pending task
46
+ - [ ] Another pending task
47
+
48
+ ## Code Blocks
49
+
50
+ Syntax highlighting for 100+ languages powered by Rouge:
51
+
52
+ ```javascript
53
+ function greet(name) {
54
+ return `Hello, ${name}!`;
55
+ }
56
+
57
+ console.log(greet('World'));
58
+ ```
59
+
60
+ ```python
61
+ def greet(name):
62
+ return f"Hello, {name}!"
63
+
64
+ print(greet('World'))
65
+ ```
66
+
67
+ ```ruby
68
+ def greet(name)
69
+ "Hello, #{name}!"
70
+ end
71
+
72
+ puts greet('World')
73
+ ```
74
+
75
+ Each code block includes a copy button for easy copying.
76
+
77
+ ## Tables
78
+
79
+ Create responsive tables with GFM syntax:
80
+
81
+ | Feature | Supported | Notes |
82
+ |---------|-----------|-------|
83
+ | Syntax highlighting | ✓ | 100+ languages |
84
+ | Hot reload | ✓ | Instant updates |
85
+ | Dark mode | ✓ | Auto-switching |
86
+ | Mobile responsive | ✓ | Works everywhere |
87
+
88
+ Tables automatically wrap on mobile devices.
89
+
90
+ ## Blockquotes
91
+
92
+ > Standard blockquote for citations or highlights.
93
+ >
94
+ > Supports multiple paragraphs.
95
+
96
+ ## Links
97
+
98
+ [Link to a page](../getting-started/installation)
99
+
100
+ [External link](https://github.com)
101
+
102
+ ## Callouts
103
+
104
+ Use callouts to highlight important information:
105
+
106
+ ::: note
107
+ Informational content that provides additional context.
108
+ :::
109
+
110
+ ::: tip Best Practice
111
+ Helpful advice or recommendations for users.
112
+ :::
113
+
114
+ ::: important
115
+ Critical information that requires special attention.
116
+ :::
117
+
118
+ ::: warning
119
+ Caution about potential issues or things to watch out for.
120
+ :::
121
+
122
+ ::: danger
123
+ Severe warnings about dangerous operations or critical issues.
124
+ :::
125
+
126
+ ### Custom Titles
127
+
128
+ ::: tip Performance Optimization
129
+ You can customize the title of any callout type.
130
+ :::
131
+
132
+ ### Rich Content
133
+
134
+ ::: important Key Requirements
135
+ Callouts support all markdown features:
136
+
137
+ - **Lists** and formatting
138
+ - `Code snippets`
139
+ - [Links](/)
140
+ - Code blocks with syntax highlighting
141
+
142
+ ```ruby
143
+ def example
144
+ puts "Code works inside callouts!"
145
+ end
146
+ ```
147
+ :::
148
+
149
+ ## Tabs
150
+
151
+ Display multiple code examples or options in tabs:
152
+
153
+ :::tabs
154
+ == JavaScript
155
+ ```javascript
156
+ const config = {
157
+ apiUrl: 'https://api.example.com',
158
+ timeout: 5000
159
+ };
160
+ ```
161
+
162
+ == TypeScript
163
+ ```typescript
164
+ interface Config {
165
+ apiUrl: string;
166
+ timeout: number;
167
+ }
168
+
169
+ const config: Config = {
170
+ apiUrl: 'https://api.example.com',
171
+ timeout: 5000
172
+ };
173
+ ```
174
+
175
+ == Ruby
176
+ ```ruby
177
+ config = {
178
+ api_url: 'https://api.example.com',
179
+ timeout: 5000
180
+ }
181
+ ```
182
+ :::
183
+
184
+ ### Package Manager Tabs
185
+
186
+ Perfect for installation instructions:
187
+
188
+ :::tabs
189
+ == npm
190
+ ```bash
191
+ npm install your-package
192
+ ```
193
+
194
+ == yarn
195
+ ```bash
196
+ yarn add your-package
197
+ ```
198
+
199
+ == pnpm
200
+ ```bash
201
+ pnpm add your-package
202
+ ```
203
+
204
+ == bun
205
+ ```bash
206
+ bun add your-package
207
+ ```
208
+ :::
209
+
210
+ Tabs automatically detect package managers and display appropriate icons.
211
+
212
+ ## Icons
213
+
214
+ Use inline icons from [Phosphor Icons](https://phosphoricons.com):
215
+
216
+ :rocket-launch: :check: :warning: :heart: :star: :code: :book-open: :gear:
217
+
218
+ Just wrap the icon name in colons:
219
+
220
+ ```markdown
221
+ :rocket-launch: :check: :warning:
222
+ ```
223
+
224
+ Browse all available icons at [phosphoricons.com](https://phosphoricons.com).
225
+
226
+ ## Horizontal Rules
227
+
228
+ Use three or more dashes, asterisks, or underscores:
229
+
230
+ ---
231
+
232
+ ## Best Practices
233
+
234
+ ::: tip Writing Great Documentation
235
+ 1. **Use headings hierarchically** - Don't skip levels (H1 → H3)
236
+ 2. **Add code examples** - Show, don't just tell
237
+ 3. **Use callouts sparingly** - Highlight only important information
238
+ 4. **Keep it concise** - Respect your readers' time
239
+ 5. **Link related pages** - Help users navigate your docs
240
+ :::
241
+
242
+ ## Next Steps
243
+
244
+ ::: note
245
+ - Learn how to [customize your site](configuration)
246
+ - Explore the [installation guide](../getting-started/installation)
247
+ :::
@@ -1,86 +1,82 @@
1
- # Welcome to Docyard
1
+ # Welcome to Your Documentation
2
2
 
3
- A modern, zero-config documentation generator for Ruby developers.
3
+ This is your documentation homepage. Docyard transforms your Markdown files into beautiful, searchable documentation.
4
4
 
5
- ## Features
5
+ ## Quick Example
6
6
 
7
- - **Auto-generated Navigation** - Sidebar built from your folder structure
8
- - **Hot Reload** - Changes appear instantly while you write
9
- - **GitHub Flavored Markdown** - Full GFM support with tables and task lists
10
- - **Syntax Highlighting** - 100+ languages powered by Rouge
11
- - **Zero Configuration** - Works out of the box with sensible defaults
12
- - **Mobile Responsive** - Beautiful on desktop, tablet, and mobile
7
+ Here's what you can do with Docyard:
13
8
 
14
- ## Quick Start
9
+ ### Code Blocks with Syntax Highlighting
15
10
 
16
- Get up and running in under a minute:
17
-
18
- ```bash
19
- # Install
20
- gem install docyard
11
+ ```ruby
12
+ class User
13
+ attr_reader :name, :email
21
14
 
22
- # Initialize
23
- docyard init
15
+ def initialize(name, email)
16
+ @name = name
17
+ @email = email
18
+ end
24
19
 
25
- # Start dev server
26
- docyard serve
20
+ def greet
21
+ "Hello, #{name}!"
22
+ end
23
+ end
27
24
  ```
28
25
 
29
- Visit `http://localhost:4200` to see your docs.
26
+ ### Callouts for Important Information
30
27
 
28
+ ::: tip Pro Tip
29
+ Use callouts to highlight important information. Available types: `note`, `tip`, `important`, `warning`, and `danger`.
30
+ :::
31
31
 
32
- ## Example Code
32
+ ::: warning
33
+ Make sure to read the [Configuration Guide](guides/configuration) before deploying to production.
34
+ :::
33
35
 
34
- Ruby with syntax highlighting:
36
+ ### Tabs for Multiple Options
35
37
 
36
- ```ruby
37
- class DocumentationSite
38
- attr_reader :title, :pages
38
+ Show installation instructions for different package managers:
39
39
 
40
- def initialize(title)
41
- @title = title
42
- @pages = []
43
- end
40
+ :::tabs
41
+ == npm
42
+ ```bash
43
+ npm install your-package
44
+ ```
44
45
 
45
- def add_page(path, content)
46
- pages << { path: path, content: content }
47
- end
46
+ == yarn
47
+ ```bash
48
+ yarn add your-package
49
+ ```
48
50
 
49
- def build
50
- pages.each { |page| render_page(page) }
51
- end
52
- end
51
+ == pnpm
52
+ ```bash
53
+ pnpm add your-package
53
54
  ```
55
+ :::
54
56
 
57
+ ### Icons
55
58
 
56
- JavaScript example:
59
+ Use inline icons from [Phosphor Icons](https://phosphoricons.com): :rocket-launch: :check: :warning: :heart:
57
60
 
58
- ```javascript
59
- function buildDocs(config) {
60
- const { title, theme } = config;
61
- console.log(`Building ${title} with ${theme} theme`);
62
- return { success: true };
63
- }
64
- ```
61
+ ## Getting Started
62
+
63
+ ::: note Next Steps
64
+ 1. Edit the files in `docs/` to create your documentation
65
+ 2. Run `docyard serve` to preview changes in real-time
66
+ 3. Customize `docyard.yml` to configure branding and navigation
67
+ 4. Run `docyard build` when ready to deploy
68
+ :::
65
69
 
66
70
  ## Documentation Structure
67
71
 
68
72
  | Section | Description |
69
73
  |---------|-------------|
70
- | Getting Started | Installation and quick start guide |
71
- | Core Concepts | Learn about file structure and markdown |
72
-
73
- ## What's Next?
74
-
75
- > Get started by exploring the documentation in the sidebar, or jump straight to the [Quick Start Guide](getting-started/quick-start).
76
-
77
- ### Learn the Basics
78
-
79
- 1. [Introduction](getting-started/introduction) - Learn what Docyard can do
80
- 2. [Installation](getting-started/installation) - Install Docyard on your system
81
- 3. [Quick Start](getting-started/quick-start) - Create your first site
74
+ | [Installation](getting-started/installation) | Get up and running quickly |
75
+ | [Markdown Features](guides/markdown-features) | Learn about all supported features |
76
+ | [Configuration](guides/configuration) | Customize appearance and navigation |
82
77
 
83
- ### Understand Core Concepts
78
+ ## Need Help?
84
79
 
85
- - [File Structure](core-concepts/file-structure) - How to organize your docs
86
- - [Markdown](core-concepts/markdown) - Supported markdown features
80
+ - Check out the [Markdown Features](guides/markdown-features) guide
81
+ - Learn about [customization options](guides/configuration)
82
+ - Explore the sidebar to see all available pages
@@ -1,7 +1,13 @@
1
- <button class="nav-group-toggle" aria-expanded="true" type="button">
2
- <span><%= @title %></span>
3
- <%= icon(:chevron) %>
1
+ <% collapsed = @collapsed || false %>
2
+ <button class="nav-group-toggle" aria-expanded="<%= collapsed ? 'false' : 'true' %>" type="button">
3
+ <span class="nav-group-title">
4
+ <% if @icon %>
5
+ <span class="nav-item-icon"><%= icon(@icon) %></span>
6
+ <% end %>
7
+ <span class="nav-item-text"><%= @title %></span>
8
+ </span>
9
+ <span class="nav-group-icon"><%= icon(:caret_right) %></span>
4
10
  </button>
5
- <div class="nav-group-children">
11
+ <div class="nav-group-children<%= ' collapsed' if collapsed %>">
6
12
  <%= @children_html %>
7
13
  </div>
@@ -1 +1,9 @@
1
- <a href="<%= @path %>"<%= ' class="active"' if @active %>><%= @title %></a>
1
+ <a href="<%= link_path(@path) %>"<%= ' class="active"' if @active %><%= " target=\"#{@target}\" rel=\"noopener noreferrer\"" if @target && @target != "_self" %>>
2
+ <% if @icon %>
3
+ <span class="nav-item-icon"><%= icon(@icon) %></span>
4
+ <% end %>
5
+ <span class="nav-item-text"><%= @title %></span>
6
+ <% if @target == "_blank" %>
7
+ <span class="nav-item-external"><%= icon(:link_external) %></span>
8
+ <% end %>
9
+ </a>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Docyard
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
data/lib/docyard.rb CHANGED
@@ -22,5 +22,13 @@ require_relative "docyard/initializer"
22
22
  require_relative "docyard/server"
23
23
  require_relative "docyard/cli"
24
24
 
25
+ # Build components
26
+ require_relative "docyard/builder"
27
+ require_relative "docyard/build/static_generator"
28
+ require_relative "docyard/build/asset_bundler"
29
+ require_relative "docyard/build/file_copier"
30
+ require_relative "docyard/build/sitemap_generator"
31
+ require_relative "docyard/preview_server"
32
+
25
33
  module Docyard
26
34
  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.3.0
4
+ version: 0.4.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,6 +184,11 @@ 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
@@ -150,6 +197,7 @@ files:
150
197
  - lib/docyard/components/icon_detector.rb
151
198
  - lib/docyard/components/icon_processor.rb
152
199
  - lib/docyard/components/registry.rb
200
+ - lib/docyard/components/table_wrapper_processor.rb
153
201
  - lib/docyard/components/tabs_parser.rb
154
202
  - lib/docyard/components/tabs_processor.rb
155
203
  - lib/docyard/config.rb
@@ -165,12 +213,15 @@ files:
165
213
  - lib/docyard/language_mapping.rb
166
214
  - lib/docyard/logging.rb
167
215
  - lib/docyard/markdown.rb
216
+ - lib/docyard/preview_server.rb
168
217
  - lib/docyard/rack_application.rb
169
218
  - lib/docyard/renderer.rb
170
219
  - lib/docyard/router.rb
171
220
  - lib/docyard/routing/resolution_result.rb
172
221
  - lib/docyard/server.rb
222
+ - lib/docyard/sidebar/config_parser.rb
173
223
  - lib/docyard/sidebar/file_system_scanner.rb
224
+ - lib/docyard/sidebar/item.rb
174
225
  - lib/docyard/sidebar/renderer.rb
175
226
  - lib/docyard/sidebar/title_extractor.rb
176
227
  - lib/docyard/sidebar/tree_builder.rb
@@ -191,6 +242,7 @@ files:
191
242
  - lib/docyard/templates/assets/css/variables.css
192
243
  - lib/docyard/templates/assets/favicon.svg
193
244
  - lib/docyard/templates/assets/js/components/code-block.js
245
+ - lib/docyard/templates/assets/js/components/navigation.js
194
246
  - lib/docyard/templates/assets/js/components/tabs.js
195
247
  - lib/docyard/templates/assets/js/reload.js
196
248
  - lib/docyard/templates/assets/js/theme.js
@@ -200,21 +252,14 @@ files:
200
252
  - lib/docyard/templates/errors/404.html.erb
201
253
  - lib/docyard/templates/errors/500.html.erb
202
254
  - 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
255
  - 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
256
+ - lib/docyard/templates/markdown/guides/configuration.md.erb
257
+ - lib/docyard/templates/markdown/guides/markdown-features.md.erb
212
258
  - lib/docyard/templates/markdown/index.md.erb
213
259
  - lib/docyard/templates/partials/_callout.html.erb
214
260
  - lib/docyard/templates/partials/_code_block.html.erb
215
261
  - lib/docyard/templates/partials/_icon.html.erb
216
262
  - lib/docyard/templates/partials/_icon_file_extension.html.erb
217
- - lib/docyard/templates/partials/_icons.html.erb
218
263
  - lib/docyard/templates/partials/_nav_group.html.erb
219
264
  - lib/docyard/templates/partials/_nav_item.html.erb
220
265
  - lib/docyard/templates/partials/_nav_leaf.html.erb