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,204 @@
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
+ :::
@@ -0,0 +1,125 @@
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.