docyard 0.1.0 → 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 (49) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -0
  3. data/CHANGELOG.md +23 -1
  4. data/README.md +16 -8
  5. data/lib/docyard/constants.rb +23 -0
  6. data/lib/docyard/errors.rb +54 -0
  7. data/lib/docyard/file_watcher.rb +2 -2
  8. data/lib/docyard/initializer.rb +9 -2
  9. data/lib/docyard/logging.rb +43 -0
  10. data/lib/docyard/rack_application.rb +29 -11
  11. data/lib/docyard/renderer.rb +5 -3
  12. data/lib/docyard/router.rb +13 -8
  13. data/lib/docyard/routing/resolution_result.rb +31 -0
  14. data/lib/docyard/sidebar/file_system_scanner.rb +77 -0
  15. data/lib/docyard/sidebar/renderer.rb +110 -0
  16. data/lib/docyard/sidebar/title_extractor.rb +25 -0
  17. data/lib/docyard/sidebar/tree_builder.rb +59 -0
  18. data/lib/docyard/sidebar_builder.rb +50 -0
  19. data/lib/docyard/templates/assets/css/code.css +214 -0
  20. data/lib/docyard/templates/assets/css/components.css +258 -0
  21. data/lib/docyard/templates/assets/css/layout.css +273 -0
  22. data/lib/docyard/templates/assets/css/main.css +10 -4
  23. data/lib/docyard/templates/assets/css/markdown.css +199 -0
  24. data/lib/docyard/templates/assets/css/reset.css +59 -0
  25. data/lib/docyard/templates/assets/css/typography.css +97 -0
  26. data/lib/docyard/templates/assets/css/variables.css +114 -0
  27. data/lib/docyard/templates/assets/js/theme.js +193 -1
  28. data/lib/docyard/templates/layouts/default.html.erb +41 -19
  29. data/lib/docyard/templates/markdown/core-concepts/file-structure.md.erb +61 -0
  30. data/lib/docyard/templates/markdown/core-concepts/markdown.md.erb +90 -0
  31. data/lib/docyard/templates/markdown/getting-started/installation.md.erb +43 -0
  32. data/lib/docyard/templates/markdown/getting-started/introduction.md.erb +30 -0
  33. data/lib/docyard/templates/markdown/getting-started/quick-start.md.erb +56 -0
  34. data/lib/docyard/templates/markdown/index.md.erb +78 -14
  35. data/lib/docyard/templates/partials/_icons.html.erb +11 -0
  36. data/lib/docyard/templates/partials/_nav_group.html.erb +7 -0
  37. data/lib/docyard/templates/partials/_nav_item.html.erb +3 -0
  38. data/lib/docyard/templates/partials/_nav_leaf.html.erb +1 -0
  39. data/lib/docyard/templates/partials/_nav_list.html.erb +3 -0
  40. data/lib/docyard/templates/partials/_nav_section.html.erb +6 -0
  41. data/lib/docyard/templates/partials/_sidebar.html.erb +6 -0
  42. data/lib/docyard/templates/partials/_sidebar_footer.html.erb +11 -0
  43. data/lib/docyard/utils/path_resolver.rb +30 -0
  44. data/lib/docyard/utils/text_formatter.rb +22 -0
  45. data/lib/docyard/version.rb +1 -1
  46. data/lib/docyard.rb +16 -4
  47. metadata +32 -3
  48. data/lib/docyard/templates/assets/css/syntax.css +0 -116
  49. data/lib/docyard/templates/markdown/getting-started.md.erb +0 -40
@@ -1,22 +1,86 @@
1
- ---
2
- title: Home
3
- description: Welcome to your documentation site
4
- ---
1
+ # Welcome to Docyard
5
2
 
6
- # Welcome to Docyard!
3
+ A modern, zero-config documentation generator for Ruby developers.
7
4
 
8
- This is your documentation homepage. Edit this file to customize it.
5
+ ## Features
9
6
 
10
- ## What is Docyard?
11
-
12
- Docyard is a beautiful, zero-config documentation generator built with Ruby.
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
13
13
 
14
14
  ## Quick Start
15
15
 
16
- 1. Edit the markdown files in `docs/`
17
- 2. Run `docyard serve` to preview your site
18
- 3. Run `docyard build` to generate static HTML
16
+ Get up and running in under a minute:
17
+
18
+ ```bash
19
+ # Install
20
+ gem install docyard
21
+
22
+ # Initialize
23
+ docyard init
24
+
25
+ # Start dev server
26
+ docyard serve
27
+ ```
28
+
29
+ Visit `http://localhost:4200` to see your docs.
30
+
31
+
32
+ ## Example Code
33
+
34
+ Ruby with syntax highlighting:
35
+
36
+ ```ruby
37
+ class DocumentationSite
38
+ attr_reader :title, :pages
39
+
40
+ def initialize(title)
41
+ @title = title
42
+ @pages = []
43
+ end
44
+
45
+ def add_page(path, content)
46
+ pages << { path: path, content: content }
47
+ end
48
+
49
+ def build
50
+ pages.each { |page| render_page(page) }
51
+ end
52
+ end
53
+ ```
54
+
55
+
56
+ JavaScript example:
57
+
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
+ ```
65
+
66
+ ## Documentation Structure
67
+
68
+ | Section | Description |
69
+ |---------|-------------|
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
19
82
 
20
- ## Learn More
83
+ ### Understand Core Concepts
21
84
 
22
- Check out the [Getting Started](getting-started.md) guide.
85
+ - [File Structure](core-concepts/file-structure) - How to organize your docs
86
+ - [Markdown](core-concepts/markdown) - Supported markdown features
@@ -0,0 +1,11 @@
1
+ <%# External link icon %>
2
+ <% if @icon_name == :external %>
3
+ <svg class="external-icon" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 256 256">
4
+ <path d="M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z" />
5
+ </svg>
6
+ <%# Chevron icon %>
7
+ <% elsif @icon_name == :chevron %>
8
+ <svg class="nav-group-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor">
9
+ <path d="M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"/>
10
+ </svg>
11
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <button class="nav-group-toggle" aria-expanded="true" type="button">
2
+ <span><%= @title %></span>
3
+ <%= icon(:chevron) %>
4
+ </button>
5
+ <div class="nav-group-children">
6
+ <%= @children_html %>
7
+ </div>
@@ -0,0 +1,3 @@
1
+ <li>
2
+ <%= @item_content %>
3
+ </li>
@@ -0,0 +1 @@
1
+ <a href="<%= @path %>"<%= ' class="active"' if @active %>><%= @title %></a>
@@ -0,0 +1,3 @@
1
+ <ul>
2
+ <%= @list_items %>
3
+ </ul>
@@ -0,0 +1,6 @@
1
+ <div class="nav-section">
2
+ <% if @section_name %>
3
+ <div class="nav-section-title"><%= @section_name %></div>
4
+ <% end %>
5
+ <%= @section_content %>
6
+ </div>
@@ -0,0 +1,6 @@
1
+ <aside class="sidebar" role="navigation" aria-label="Documentation navigation">
2
+ <nav>
3
+ <%= @nav_content %>
4
+ </nav>
5
+ <%= @footer_html %>
6
+ </aside>
@@ -0,0 +1,11 @@
1
+ <div class="sidebar-footer">
2
+ <a href="https://github.com/sanifhimani/docyard"
3
+ target="_blank"
4
+ rel="noopener noreferrer"
5
+ class="sidebar-footer-link">
6
+ <div class="sidebar-footer-text">
7
+ <p class="sidebar-footer-title">Built with Docyard</p>
8
+ </div>
9
+ <%= icon(:external) %>
10
+ </a>
11
+ </div>
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Docyard
4
+ module Utils
5
+ class PathResolver
6
+ def self.normalize(path)
7
+ return "/" if path.nil? || path.empty?
8
+
9
+ normalized = path.delete_suffix(".md")
10
+ .delete_suffix("/index")
11
+
12
+ normalized = "" if normalized == "index"
13
+
14
+ normalized = "/" if normalized.empty?
15
+ normalized = "/#{normalized}" unless normalized.start_with?("/")
16
+ normalized
17
+ end
18
+
19
+ def self.to_url(relative_path)
20
+ normalize(relative_path)
21
+ end
22
+
23
+ def self.ancestor?(parent_path, child_path)
24
+ return false if parent_path.nil?
25
+
26
+ child_path.start_with?(parent_path) && child_path != parent_path
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Docyard
4
+ module Utils
5
+ class TextFormatter
6
+ def self.titleize(string)
7
+ return "Home" if string == "index"
8
+
9
+ string.gsub(/[-_]/, " ")
10
+ .split
11
+ .map(&:capitalize)
12
+ .join(" ")
13
+ end
14
+
15
+ def self.slugify(string)
16
+ string.downcase
17
+ .gsub(/\s+/, "-")
18
+ .gsub(/[^a-z0-9-]/, "")
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Docyard
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
data/lib/docyard.rb CHANGED
@@ -1,14 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # Core modules
3
4
  require_relative "docyard/version"
4
- require_relative "docyard/cli"
5
- require_relative "docyard/initializer"
6
- require_relative "docyard/markdown"
5
+ require_relative "docyard/constants"
6
+ require_relative "docyard/errors"
7
+ require_relative "docyard/logging"
8
+
9
+ # Utilities
10
+ require_relative "docyard/utils/text_formatter"
11
+ require_relative "docyard/utils/path_resolver"
12
+
13
+ # Routing
14
+ require_relative "docyard/routing/resolution_result"
7
15
  require_relative "docyard/router"
16
+
17
+ # Application components
18
+ require_relative "docyard/markdown"
8
19
  require_relative "docyard/renderer"
9
20
  require_relative "docyard/asset_handler"
21
+ require_relative "docyard/initializer"
10
22
  require_relative "docyard/server"
23
+ require_relative "docyard/cli"
11
24
 
12
25
  module Docyard
13
- class Error < StandardError; end
14
26
  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.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sanif Himani
@@ -142,22 +142,51 @@ files:
142
142
  - lib/docyard.rb
143
143
  - lib/docyard/asset_handler.rb
144
144
  - lib/docyard/cli.rb
145
+ - lib/docyard/constants.rb
146
+ - lib/docyard/errors.rb
145
147
  - lib/docyard/file_watcher.rb
146
148
  - lib/docyard/initializer.rb
149
+ - lib/docyard/logging.rb
147
150
  - lib/docyard/markdown.rb
148
151
  - lib/docyard/rack_application.rb
149
152
  - lib/docyard/renderer.rb
150
153
  - lib/docyard/router.rb
154
+ - lib/docyard/routing/resolution_result.rb
151
155
  - lib/docyard/server.rb
156
+ - lib/docyard/sidebar/file_system_scanner.rb
157
+ - lib/docyard/sidebar/renderer.rb
158
+ - lib/docyard/sidebar/title_extractor.rb
159
+ - lib/docyard/sidebar/tree_builder.rb
160
+ - lib/docyard/sidebar_builder.rb
161
+ - lib/docyard/templates/assets/css/code.css
162
+ - lib/docyard/templates/assets/css/components.css
163
+ - lib/docyard/templates/assets/css/layout.css
152
164
  - lib/docyard/templates/assets/css/main.css
153
- - lib/docyard/templates/assets/css/syntax.css
165
+ - lib/docyard/templates/assets/css/markdown.css
166
+ - lib/docyard/templates/assets/css/reset.css
167
+ - lib/docyard/templates/assets/css/typography.css
168
+ - lib/docyard/templates/assets/css/variables.css
154
169
  - lib/docyard/templates/assets/js/reload.js
155
170
  - lib/docyard/templates/assets/js/theme.js
156
171
  - lib/docyard/templates/errors/404.html.erb
157
172
  - lib/docyard/templates/errors/500.html.erb
158
173
  - lib/docyard/templates/layouts/default.html.erb
159
- - lib/docyard/templates/markdown/getting-started.md.erb
174
+ - lib/docyard/templates/markdown/core-concepts/file-structure.md.erb
175
+ - lib/docyard/templates/markdown/core-concepts/markdown.md.erb
176
+ - lib/docyard/templates/markdown/getting-started/installation.md.erb
177
+ - lib/docyard/templates/markdown/getting-started/introduction.md.erb
178
+ - lib/docyard/templates/markdown/getting-started/quick-start.md.erb
160
179
  - lib/docyard/templates/markdown/index.md.erb
180
+ - lib/docyard/templates/partials/_icons.html.erb
181
+ - lib/docyard/templates/partials/_nav_group.html.erb
182
+ - lib/docyard/templates/partials/_nav_item.html.erb
183
+ - lib/docyard/templates/partials/_nav_leaf.html.erb
184
+ - lib/docyard/templates/partials/_nav_list.html.erb
185
+ - lib/docyard/templates/partials/_nav_section.html.erb
186
+ - lib/docyard/templates/partials/_sidebar.html.erb
187
+ - lib/docyard/templates/partials/_sidebar_footer.html.erb
188
+ - lib/docyard/utils/path_resolver.rb
189
+ - lib/docyard/utils/text_formatter.rb
161
190
  - lib/docyard/version.rb
162
191
  - sig/docyard.rbs
163
192
  homepage: https://github.com/sanifhimani/docyard
@@ -1,116 +0,0 @@
1
- .highlight table td { padding: 5px; }
2
- .highlight table pre { margin: 0; }
3
- .highlight, .highlight .w {
4
- color: #24292f;
5
- background-color: #f6f8fa;
6
- }
7
- .highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kt, .highlight .kv {
8
- color: #cf222e;
9
- }
10
- .highlight .gr {
11
- color: #f6f8fa;
12
- }
13
- .highlight .gd {
14
- color: #82071e;
15
- background-color: #ffebe9;
16
- }
17
- .highlight .nb {
18
- color: #953800;
19
- }
20
- .highlight .nc {
21
- color: #953800;
22
- }
23
- .highlight .no {
24
- color: #953800;
25
- }
26
- .highlight .nn {
27
- color: #953800;
28
- }
29
- .highlight .sr {
30
- color: #116329;
31
- }
32
- .highlight .na {
33
- color: #116329;
34
- }
35
- .highlight .nt {
36
- color: #116329;
37
- }
38
- .highlight .gi {
39
- color: #116329;
40
- background-color: #dafbe1;
41
- }
42
- .highlight .ges {
43
- font-weight: bold;
44
- font-style: italic;
45
- }
46
- .highlight .kc {
47
- color: #0550ae;
48
- }
49
- .highlight .l, .highlight .ld, .highlight .m, .highlight .mb, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .il, .highlight .mo, .highlight .mx {
50
- color: #0550ae;
51
- }
52
- .highlight .sb {
53
- color: #0550ae;
54
- }
55
- .highlight .bp {
56
- color: #0550ae;
57
- }
58
- .highlight .ne {
59
- color: #0550ae;
60
- }
61
- .highlight .nl {
62
- color: #0550ae;
63
- }
64
- .highlight .py {
65
- color: #0550ae;
66
- }
67
- .highlight .nv, .highlight .vc, .highlight .vg, .highlight .vi, .highlight .vm {
68
- color: #0550ae;
69
- }
70
- .highlight .o, .highlight .ow {
71
- color: #0550ae;
72
- }
73
- .highlight .gh {
74
- color: #0550ae;
75
- font-weight: bold;
76
- }
77
- .highlight .gu {
78
- color: #0550ae;
79
- font-weight: bold;
80
- }
81
- .highlight .s, .highlight .sa, .highlight .sc, .highlight .dl, .highlight .sd, .highlight .s2, .highlight .se, .highlight .sh, .highlight .sx, .highlight .s1, .highlight .ss {
82
- color: #0a3069;
83
- }
84
- .highlight .nd {
85
- color: #8250df;
86
- }
87
- .highlight .nf, .highlight .fm {
88
- color: #8250df;
89
- }
90
- .highlight .err {
91
- color: #f6f8fa;
92
- background-color: #82071e;
93
- }
94
- .highlight .c, .highlight .ch, .highlight .cd, .highlight .cm, .highlight .cp, .highlight .cpf, .highlight .c1, .highlight .cs {
95
- color: #6e7781;
96
- }
97
- .highlight .gl {
98
- color: #6e7781;
99
- }
100
- .highlight .gt {
101
- color: #6e7781;
102
- }
103
- .highlight .ni {
104
- color: #24292f;
105
- }
106
- .highlight .si {
107
- color: #24292f;
108
- }
109
- .highlight .ge {
110
- color: #24292f;
111
- font-style: italic;
112
- }
113
- .highlight .gs {
114
- color: #24292f;
115
- font-weight: bold;
116
- }
@@ -1,40 +0,0 @@
1
- ---
2
- title: Getting Started
3
- description: Learn how to use Docyard
4
- ---
5
-
6
- # Getting Started
7
-
8
- Welcome! This guide will help you get started with Docyard.
9
-
10
- ## Writing Documentation
11
-
12
- Just write markdown files in the `docs/` folder.
13
-
14
- ### Frontmatter
15
-
16
- Each markdown file can have YAML frontmatter:
17
-
18
- ```yaml
19
- ---
20
- title: Page Title
21
- description: Page description
22
- ---
23
-
24
- Markdown Syntax
25
-
26
- Docyard supports all standard markdown:
27
-
28
- - Bold text
29
- - Italic text
30
- - Code snippets
31
- - Links and images
32
- - Code blocks with syntax highlighting
33
-
34
- Next Steps
35
-
36
- - Add more markdown files to docs/
37
- - Organize files into folders
38
- - Customize your site with docyard.yml
39
-
40
- Happy documenting! 📚