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,30 @@
1
+ # Introduction
2
+
3
+ Welcome to Docyard - a modern, zero-config documentation generator for Ruby developers.
4
+
5
+ ## What is Docyard?
6
+
7
+ Docyard turns your Markdown files into beautiful, searchable documentation sites. Write docs in Markdown, and Docyard handles the rest.
8
+
9
+ ## Key Features
10
+
11
+ - **Auto-generated Navigation** - Sidebar navigation built from your folder structure
12
+ - **Hot Reload** - See changes instantly as you write
13
+ - **GitHub Flavored Markdown** - Full GFM support including tables and task lists
14
+ - **Syntax Highlighting** - 100+ languages powered by Rouge
15
+ - **Zero Configuration** - Works out of the box with sensible defaults
16
+ - **Mobile Responsive** - Looks great on all devices
17
+
18
+ ## Philosophy
19
+
20
+ Docyard follows these principles:
21
+
22
+ 1. **Simple by default** - No configuration needed to get started
23
+ 2. **Markdown-first** - Focus on writing, not tooling
24
+ 3. **Beautiful out of the box** - Production-ready styling included
25
+ 4. **Developer friendly** - Built by developers, for developers
26
+
27
+ ## Next Steps
28
+
29
+ - [Install Docyard](installation) to get started
30
+ - Check out the [Quick Start Guide](quick-start) for a 5-minute tutorial
@@ -0,0 +1,56 @@
1
+ # Quick Start
2
+
3
+ Get up and running with Docyard in under 5 minutes.
4
+
5
+ ## 1. Install Docyard
6
+
7
+ ```bash
8
+ gem install docyard
9
+ ```
10
+
11
+ ## 2. Initialize Your Project
12
+
13
+ Create a new documentation project:
14
+
15
+ ```bash
16
+ docyard init
17
+ ```
18
+
19
+
20
+ This creates a `docs/` folder with sample documentation files.
21
+
22
+ ## 3. Start the Dev Server
23
+
24
+ ```bash
25
+ docyard serve
26
+ ```
27
+
28
+
29
+ Your documentation will be available at `http://localhost:4200`.
30
+
31
+ ## 4. Edit Your Docs
32
+
33
+ Open `docs/index.md` and make some changes. The browser will automatically reload to show your changes.
34
+
35
+ ## 5. Organize Your Content
36
+
37
+ Create folders to organize your documentation:
38
+
39
+ ```bash
40
+ docs/
41
+ ├── index.md
42
+ ├── getting-started/
43
+ │ ├── introduction.md
44
+ │ └── installation.md
45
+ └── guides/
46
+ ├── basic-usage.md
47
+ └── advanced-features.md
48
+ ```
49
+
50
+
51
+ The sidebar navigation will automatically reflect your folder structure.
52
+
53
+ ## What's Next?
54
+
55
+ - Learn about [File Structure](../core-concepts/file-structure) conventions
56
+ - Explore [Markdown](../core-concepts/markdown) syntax and features
@@ -0,0 +1,86 @@
1
+ # Welcome to Docyard
2
+
3
+ A modern, zero-config documentation generator for Ruby developers.
4
+
5
+ ## Features
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
13
+
14
+ ## Quick Start
15
+
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
82
+
83
+ ### Understand Core Concepts
84
+
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.0.1"
4
+ VERSION = "0.2.0"
5
5
  end
data/lib/docyard.rb CHANGED
@@ -1,8 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # Core modules
3
4
  require_relative "docyard/version"
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"
15
+ require_relative "docyard/router"
16
+
17
+ # Application components
18
+ require_relative "docyard/markdown"
19
+ require_relative "docyard/renderer"
20
+ require_relative "docyard/asset_handler"
21
+ require_relative "docyard/initializer"
22
+ require_relative "docyard/server"
23
+ require_relative "docyard/cli"
4
24
 
5
25
  module Docyard
6
- class Error < StandardError; end
7
- # Your code goes here...
8
26
  end
metadata CHANGED
@@ -1,14 +1,126 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docyard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sanif Himani
8
8
  bindir: exe
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
- dependencies: []
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: kramdown
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '2.5'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '2.5'
26
+ - !ruby/object:Gem::Dependency
27
+ name: kramdown-parser-gfm
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '1.1'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.1'
40
+ - !ruby/object:Gem::Dependency
41
+ name: listen
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '3.0'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '3.0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: logger
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.6'
61
+ type: :runtime
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '1.6'
68
+ - !ruby/object:Gem::Dependency
69
+ name: rack
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '3.0'
75
+ type: :runtime
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '3.0'
82
+ - !ruby/object:Gem::Dependency
83
+ name: rouge
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '4.0'
89
+ type: :runtime
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '4.0'
96
+ - !ruby/object:Gem::Dependency
97
+ name: thor
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '1.4'
103
+ type: :runtime
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '1.4'
110
+ - !ruby/object:Gem::Dependency
111
+ name: webrick
112
+ requirement: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '1.0'
117
+ type: :runtime
118
+ prerelease: false
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '1.0'
12
124
  description: Beautiful, zero-config documentation sites. Built with Ruby.
13
125
  email:
14
126
  - sanifhimani92@gmail.com
@@ -16,11 +128,65 @@ executables: []
16
128
  extensions: []
17
129
  extra_rdoc_files: []
18
130
  files:
131
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
132
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
133
+ - ".github/pull_request_template.md"
134
+ - ".github/workflows/ci.yml"
135
+ - ".rubocop.yml"
136
+ - CHANGELOG.md
19
137
  - CODE_OF_CONDUCT.md
138
+ - CONTRIBUTING.md
20
139
  - LICENSE.txt
21
140
  - README.md
22
141
  - Rakefile
23
142
  - lib/docyard.rb
143
+ - lib/docyard/asset_handler.rb
144
+ - lib/docyard/cli.rb
145
+ - lib/docyard/constants.rb
146
+ - lib/docyard/errors.rb
147
+ - lib/docyard/file_watcher.rb
148
+ - lib/docyard/initializer.rb
149
+ - lib/docyard/logging.rb
150
+ - lib/docyard/markdown.rb
151
+ - lib/docyard/rack_application.rb
152
+ - lib/docyard/renderer.rb
153
+ - lib/docyard/router.rb
154
+ - lib/docyard/routing/resolution_result.rb
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
164
+ - lib/docyard/templates/assets/css/main.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
169
+ - lib/docyard/templates/assets/js/reload.js
170
+ - lib/docyard/templates/assets/js/theme.js
171
+ - lib/docyard/templates/errors/404.html.erb
172
+ - lib/docyard/templates/errors/500.html.erb
173
+ - lib/docyard/templates/layouts/default.html.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
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
24
190
  - lib/docyard/version.rb
25
191
  - sig/docyard.rbs
26
192
  homepage: https://github.com/sanifhimani/docyard
@@ -30,6 +196,7 @@ metadata:
30
196
  allowed_push_host: https://rubygems.org
31
197
  homepage_uri: https://github.com/sanifhimani/docyard
32
198
  source_code_uri: https://github.com/sanifhimani/docyard
199
+ rubygems_mfa_required: 'true'
33
200
  rdoc_options: []
34
201
  require_paths:
35
202
  - lib