readme_yard 0.5.0 → 0.6.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.
data/docs/index.html CHANGED
@@ -57,10 +57,11 @@
57
57
  <div class="clear"></div>
58
58
  </div>
59
59
 
60
- <div id="content"><div id='filecontents'><h1 id="readme-yard-">Readme Yard 🌿</h1>
61
- <p><a href="https://badge.fury.io/rb/readme_yard"><img src="https://badge.fury.io/rb/readme_yard.svg" alt="Gem Version" /></a></p>
60
+ <div id="content"><div id='filecontents'><h1 id="readme-yard">Readme Yard 🌿</h1>
62
61
 
63
- <p><strong>Code Version: 0.4.0</strong></p>
62
+ <p><a href="https://badge.fury.io/rb/readme_yard"><img src="https://badge.fury.io/rb/readme_yard.svg" alt="Gem Version"></a></p>
63
+
64
+ <p><strong>Code Version: 0.5.0</strong></p>
64
65
 
65
66
  <p>Build a better README with <a href="https://yardoc.org">YARD</a>
66
67
  by generating it straight from the source.</p>
@@ -74,52 +75,56 @@ across your codebase and project README.</p>
74
75
 
75
76
  <p>Look at the <a href="https://github.com/mattruzicka/readme_yard/blob/main/README_YARD.md">README_YARD.md</a>
76
77
  template for this project to see how it works.
77
- If youre reading the README, that means this text is here
78
+ If you&#39;re reading the README, that means this text is here
78
79
  because the custom <code>{@readme ReadmeYard}</code> markdown tag is in
79
80
  README_YARD.md and <code>readme build</code> was run at the command line.</p>
80
81
 
81
- <hr />
82
+ <hr>
82
83
 
83
84
  <p>⚠️ <strong>Generated file warning</strong> – Edit README_YARD.md, not README.md. Changes to README.md will be lost when running <code>readme build</code>.</p>
84
85
 
85
- <p><strong>Future Work</strong>
86
- - Implement safeguards to prevent accidental edits to README.md
87
- - Support bidirectional editing through git integration</p>
86
+ <p><strong>Future Work</strong></p>
87
+
88
+ <ul>
89
+ <li>Implement safeguards to prevent accidental edits to README.md</li>
90
+ <li>Support bidirectional editing through git integration</li>
91
+ </ul>
88
92
 
89
93
  <p><a href="#contributing">PRs are welcome</a> for these improvements.</p>
90
94
 
91
- <hr />
95
+ <hr>
92
96
 
93
97
  <h2 id="table-of-contents">Table of Contents</h2>
98
+
94
99
  <ul>
95
- <li><a href="#installation">Installation</a></li>
96
- <li><a href="#getting-started">Getting Started</a></li>
97
- <li><a href="#command-line-usage">Command Line Usage</a></li>
98
- <li><a href="#tag-usage">Tag Usage</a></li>
99
- <li><a href="#readme-tag">Readme Tag</a></li>
100
- <li><a href="#standalone-tag-usage">Standalone Tag Usage</a></li>
101
- <li><a href="#example-tag">Example Tag</a></li>
102
- <li><a href="#contributing">Contributing</a></li>
103
- <li><a href="https://mattruzicka.github.io/readme_yard/">Documentation</a></li>
100
+ <li><a href="#installation">Installation</a></li>
101
+ <li><a href="#getting-started">Getting Started</a></li>
102
+ <li><a href="#command-line-usage">Command Line Usage</a></li>
103
+ <li><a href="#tag-usage">Tag Usage</a></li>
104
+ <li><a href="#readme-tag">Readme Tag</a></li>
105
+ <li><a href="#standalone-tag-usage">Standalone Tag Usage</a></li>
106
+ <li><a href="#example-tag">Example Tag</a></li>
107
+ <li><a href="#contributing">Contributing</a></li>
108
+ <li><a href="https://mattruzicka.github.io/readme_yard/">Documentation</a></li>
104
109
  </ul>
105
110
 
106
- <hr />
111
+ <hr>
107
112
 
108
113
  <h2 id="installation">Installation</h2>
109
114
 
110
- <p>Add <a href="https://rubygems.org/gems/readme_yard">gem readme_yard”</a> to your Gemfile and run <code>bundle install</code> or install it yourself with: <code>gem install readme_yard</code></p>
115
+ <p>Add <a href="https://rubygems.org/gems/readme_yard">gem &quot;readme_yard&quot;</a> to your Gemfile and run <code>bundle install</code> or install it yourself with: <code>gem install readme_yard</code></p>
111
116
 
112
117
  <p><strong>Note:</strong> As of version 0.3.0, Readme Yard requires Ruby 3.0 or higher.</p>
113
118
 
114
119
  <h2 id="getting-started">Getting Started</h2>
115
120
 
116
- <p>Run <code>readme build</code> at the command line. This creates a README_YARD.md file if there isnt one by copying your existing README.md file.</p>
121
+ <p>Run <code>readme build</code> at the command line. This creates a README_YARD.md file if there isn&#39;t one by copying your existing README.md file.</p>
117
122
 
118
123
  <p>README_YARD.md is the template from which <code>readme build</code> generates the README. Readme Yard adds the ability to embed and reference your source code in your README via README_YARD.md.</p>
119
124
 
120
125
  <p>See <a href="#tag-usage">Tag Usage</a>.</p>
121
126
 
122
- <hr />
127
+ <hr>
123
128
 
124
129
  <h2 id="command-line-usage">Command Line Usage</h2>
125
130
 
@@ -131,7 +136,7 @@ README_YARD.md and <code>readme build</code> was run at the command line.</p>
131
136
 
132
137
  <p><code>readme version</code> - Prints the current version of ReadmeYard.</p>
133
138
 
134
- <hr />
139
+ <hr>
135
140
 
136
141
  <h2 id="tag-usage">Tag Usage</h2>
137
142
 
@@ -141,94 +146,90 @@ README_YARD.md and <code>readme build</code> was run at the command line.</p>
141
146
 
142
147
  <h3 id="tag-reference-table">Tag Reference Table</h3>
143
148
 
144
- <table>
145
- <thead>
146
- <tr>
147
- <th>Tag Type</th>
148
- <th>YARD Syntax (in source code)</th>
149
- <th>Markdown Syntax (in README_YARD.md)</th>
150
- <th>Standalone Tag*</th>
151
- <th>Purpose</th>
152
- </tr>
153
- </thead>
154
- <tbody>
155
- <tr>
156
- <td>Readme</td>
157
- <td><code>@readme</code></td>
158
- <td><code>{@readme ObjectPath}</code></td>
159
- <td>N/A</td>
160
- <td>General purpose tag to embed content from source code</td>
161
- </tr>
162
- <tr>
163
- <td>Readme (comment)</td>
164
- <td><code>@readme comment</code></td>
165
- <td><code>{@readme ObjectPath}</code></td>
166
- <td><code>{@comment ObjectPath}</code></td>
167
- <td>Embeds only the comment from source code</td>
168
- </tr>
169
- <tr>
170
- <td>Readme (code)</td>
171
- <td><code>@readme code</code></td>
172
- <td><code>{@readme ObjectPath}</code></td>
173
- <td><code>{@code ObjectPath}</code></td>
174
- <td>Embeds only code implementation</td>
175
- </tr>
176
- <tr>
177
- <td>Readme (source)</td>
178
- <td><code>@readme source</code></td>
179
- <td><code>{@readme ObjectPath}</code></td>
180
- <td><code>{@source ObjectPath}</code></td>
181
- <td>Embeds both comments and code</td>
182
- </tr>
183
- <tr>
184
- <td>Readme (value)</td>
185
- <td><code>@readme value</code></td>
186
- <td><code>{@readme ObjectPath}</code></td>
187
- <td><code>{@value ObjectPath}</code></td>
188
- <td>Embeds a Ruby value as a Ruby code block</td>
189
- </tr>
190
- <tr>
191
- <td>Readme (string)</td>
192
- <td><code>@readme string</code></td>
193
- <td><code>{@readme ObjectPath}</code></td>
194
- <td><code>{@string ObjectPath}</code></td>
195
- <td>Embeds a Ruby string as normal text</td>
196
- </tr>
197
- <tr>
198
- <td>Example</td>
199
- <td><code>@example</code></td>
200
- <td><code>{@example ObjectPath}</code></td>
201
- <td>N/A</td>
202
- <td>Embeds example code from YARD @example tags</td>
203
- </tr>
204
- </tbody>
205
- </table>
149
+ <table><thead>
150
+ <tr>
151
+ <th>Tag Type</th>
152
+ <th>YARD Syntax (in source code)</th>
153
+ <th>Markdown Syntax (in README_YARD.md)</th>
154
+ <th>Standalone Tag*</th>
155
+ <th>Purpose</th>
156
+ </tr>
157
+ </thead><tbody>
158
+ <tr>
159
+ <td>Readme</td>
160
+ <td><code>@readme</code></td>
161
+ <td><code>{@readme ObjectPath}</code></td>
162
+ <td>N/A</td>
163
+ <td>General purpose tag to embed content from source code</td>
164
+ </tr>
165
+ <tr>
166
+ <td>Readme (comment)</td>
167
+ <td><code>@readme comment</code></td>
168
+ <td><code>{@readme ObjectPath}</code></td>
169
+ <td><code>{@comment ObjectPath}</code></td>
170
+ <td>Embeds only the comment from source code</td>
171
+ </tr>
172
+ <tr>
173
+ <td>Readme (code)</td>
174
+ <td><code>@readme code</code></td>
175
+ <td><code>{@readme ObjectPath}</code></td>
176
+ <td><code>{@code ObjectPath}</code></td>
177
+ <td>Embeds only code implementation</td>
178
+ </tr>
179
+ <tr>
180
+ <td>Readme (source)</td>
181
+ <td><code>@readme source</code></td>
182
+ <td><code>{@readme ObjectPath}</code></td>
183
+ <td><code>{@source ObjectPath}</code></td>
184
+ <td>Embeds both comments and code</td>
185
+ </tr>
186
+ <tr>
187
+ <td>Readme (value)</td>
188
+ <td><code>@readme value</code></td>
189
+ <td><code>{@readme ObjectPath}</code></td>
190
+ <td><code>{@value ObjectPath}</code></td>
191
+ <td>Embeds a Ruby value as a Ruby code block</td>
192
+ </tr>
193
+ <tr>
194
+ <td>Readme (string)</td>
195
+ <td><code>@readme string</code></td>
196
+ <td><code>{@readme ObjectPath}</code></td>
197
+ <td><code>{@string ObjectPath}</code></td>
198
+ <td>Embeds a Ruby string as normal text</td>
199
+ </tr>
200
+ <tr>
201
+ <td>Example</td>
202
+ <td><code>@example</code></td>
203
+ <td><code>{@example ObjectPath}</code></td>
204
+ <td>N/A</td>
205
+ <td>Embeds example code from YARD @example tags</td>
206
+ </tr>
207
+ </tbody></table>
206
208
 
207
209
  <blockquote>
208
- <p>*Standalone tags allow embedding content without requiring corresponding YARD tags in source code. See <a href="#standalone-tag-usage">Standalone Tag Usage</a> for details.</p>
210
+ <p>*Standalone tags allow embedding content without requiring corresponding YARD tags in source code. See <a href="#standalone-tag-usage">Standalone Tag Usage</a> for details.</p>
209
211
  </blockquote>
210
212
 
211
213
  <h3 id="examples">Examples</h3>
212
214
 
213
- <p>The next line is a code snippet if youre looking at the <a href="https://github.com/mattruzicka/readme_yard/blob/main/README.md">README</a> and <code>{@readme ReadmeYard::ExampleTag.hello_world}</code> if youre looking at <a href="https://github.com/mattruzicka/readme_yard/blob/main/README_YARD.md">README_YARD.md</a>.</p>
215
+ <p>The next line is a code snippet if you&#39;re looking at the <a href="https://github.com/mattruzicka/readme_yard/blob/main/README.md">README</a> and <code>{@readme ReadmeYard::ExampleTag.hello_world}</code> if you&#39;re looking at <a href="https://github.com/mattruzicka/readme_yard/blob/main/README_YARD.md">README_YARD.md</a>.</p>
214
216
 
215
- <p><code>ruby
216
- #
217
- # @example
218
- # ReadmeYard::ExampleTag.hello_world #=&gt; "Hello 🌎 🌍 🌏"
219
- #
220
- def hello_world
221
- "Hello 🌎 🌍 🌏"
222
- end
223
- </code></p>
217
+ <pre class="code ruby"><code class="ruby"><span class='comment'>#
218
+ </span><span class='comment'># @example
219
+ </span><span class='comment'># ReadmeYard::ExampleTag.hello_world #=&gt; &quot;Hello 🌎 🌍 🌏&quot;
220
+ </span><span class='comment'>#
221
+ </span><span class='kw'>def</span> <span class='id identifier rubyid_hello_world'>hello_world</span>
222
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Hello 🌎 🌍 🌏</span><span class='tstring_end'>&quot;</span></span>
223
+ <span class='kw'>end</span>
224
+ </code></pre>
224
225
 
225
226
  <p>The markdown tag tells Readme Yard to parse the <code>@readme</code> tag located above the <code>hello_world</code> class method located in <a href="https://github.com/mattruzicka/readme_yard/blob/main/lib/readme_yard/example_tag.rb">lib/readme_yard/example_tag.rb</a>.</p>
226
227
 
227
- <p>To use another meta example, <code>{@readme ReadmeYard}</code> is used at the top of this projects README_YARD.md file to generate the first few sentences of this README. <code>ReadmeYard</code> references the class located in <a href="https://github.com/mattruzicka/readme_yard/blob/main/lib/readme_yard.rb">lib/readme_yard.rb</a>.</p>
228
+ <p>To use another &quot;meta&quot; example, <code>{@readme ReadmeYard}</code> is used at the top of this project&#39;s README_YARD.md file to generate the first few sentences of this README. <code>ReadmeYard</code> references the class located in <a href="https://github.com/mattruzicka/readme_yard/blob/main/lib/readme_yard.rb">lib/readme_yard.rb</a>.</p>
228
229
 
229
- <p>Last one, <code>{@readme ReadmeYard#command_line_usage}</code> is used to generate the Command Line Usage section above from the comments of the <code>command_line_usage</code> instance method located in <a href="https://github.com/mattruzicka/readme_yard/blob/main/lib/readme_yard.rb">lib/readme_yard.rb</a>. This method is extra meta: it returns the result of formatting its own comments as markdown. In this way, the usage instructions in the comments, the README, and as printed at the command line will always be in sync.</p>
230
+ <p>Last one, <code>{@readme ReadmeYard#command_line_usage}</code> is used to generate the &quot;Command Line Usage&quot; section above from the comments of the <code>command_line_usage</code> instance method located in <a href="https://github.com/mattruzicka/readme_yard/blob/main/lib/readme_yard.rb">lib/readme_yard.rb</a>. This method is extra meta: it returns the result of formatting its own comments as markdown. In this way, the usage instructions in the comments, the README, and as printed at the command line will always be in sync.</p>
230
231
 
231
- <hr />
232
+ <hr>
232
233
 
233
234
  <h2 id="readme-tag">Readme Tag</h2>
234
235
 
@@ -244,70 +245,62 @@ embed behavior can be changed through the use of tag names.</p>
244
245
 
245
246
  <p><strong>Usage:</strong></p>
246
247
 
247
- <p><code>ruby
248
- # @readme comment
249
- </code></p>
248
+ <pre class="code ruby"><code class="ruby"><span class='comment'># @readme comment
249
+ </span></code></pre>
250
250
 
251
251
  <p>This example <a href="https://github.com/mattruzicka/readme_yard/blob/main/lib/readme_yard/comment_tag.rb">@readme comment</a> tag embeds the below code snippet via the <code>{@readme ReadmeYard::CommentTag.format_tag}</code> markdown tag.</p>
252
252
 
253
- <p><code>ruby
254
- #
255
- # This comment is in the README because `@readme comment`
256
- # is below (in the source code).
257
- #
258
- </code></p>
253
+ <pre class="code ruby"><code class="ruby"><span class='comment'>#
254
+ </span><span class='comment'># This comment is in the README because `@readme comment`
255
+ </span><span class='comment'># is below (in the source code).
256
+ </span><span class='comment'>#
257
+ </span></code></pre>
259
258
 
260
259
  <h3 id="embed-ruby-code">Embed Ruby code</h3>
261
260
 
262
261
  <p><strong>Usage:</strong></p>
263
262
 
264
- <p><code>ruby
265
- # @readme code
266
- </code></p>
263
+ <pre class="code ruby"><code class="ruby"><span class='comment'># @readme code
264
+ </span></code></pre>
267
265
 
268
266
  <p>This example <a href="https://github.com/mattruzicka/readme_yard/blob/main/lib/readme_yard/code_tag.rb">@readme code</a> tag embeds the below code snippet via the <code>{@readme ReadmeYard::CodeTag.format_tag}</code> markdown tag.</p>
269
267
 
270
- <p><code>ruby
271
- def format_tag(yard_object, _tag)
272
- ExampleTag.format_ruby(yard_object.source)
273
- end
274
- </code></p>
268
+ <pre class="code ruby"><code class="ruby"><span class='kw'>def</span> <span class='id identifier rubyid_format_tag'>format_tag</span><span class='lparen'>(</span><span class='id identifier rubyid_yard_object'>yard_object</span><span class='comma'>,</span> <span class='id identifier rubyid__tag'>_tag</span><span class='rparen'>)</span>
269
+ <span class='const'>ExampleTag</span><span class='period'>.</span><span class='id identifier rubyid_format_ruby'>format_ruby</span><span class='lparen'>(</span><span class='id identifier rubyid_yard_object'>yard_object</span><span class='period'>.</span><span class='id identifier rubyid_source'>source</span><span class='rparen'>)</span>
270
+ <span class='kw'>end</span>
271
+ </code></pre>
275
272
 
276
273
  <h3 id="embed-ruby-comments-and-code">Embed Ruby comments and code</h3>
277
274
 
278
275
  <p><strong>Usage:</strong></p>
279
276
 
280
- <p><code>ruby
281
- # @readme source
282
- </code></p>
277
+ <pre class="code ruby"><code class="ruby"><span class='comment'># @readme source
278
+ </span></code></pre>
283
279
 
284
280
  <p>This example <a href="https://github.com/mattruzicka/readme_yard/blob/main/lib/readme_yard/source_tag.rb">@readme source</a> tag embeds the below code snippet via the <code>{@readme ReadmeYard::SourceTag.format_tag}</code> markdown tag.</p>
285
281
 
286
- <p><code>ruby
287
- #
288
- # The comment and code for ReadmeYard::SourceTag#format_tag
289
- # is in the README because `@readme source` is below (in the source code).
290
- #
291
- def format_tag(yard_object, _tag)
292
- text = CommentTag.format_docstring_as_comment(yard_object)
293
- text &lt;&lt; "\n#{yard_object.source}"
294
- ExampleTag.format_ruby(text)
295
- end
296
- </code></p>
282
+ <pre class="code ruby"><code class="ruby"><span class='comment'>#
283
+ </span><span class='comment'># The comment and code for ReadmeYard::SourceTag#format_tag
284
+ </span><span class='comment'># is in the README because `@readme source` is below (in the source code).
285
+ </span><span class='comment'>#
286
+ </span><span class='kw'>def</span> <span class='id identifier rubyid_format_tag'>format_tag</span><span class='lparen'>(</span><span class='id identifier rubyid_yard_object'>yard_object</span><span class='comma'>,</span> <span class='id identifier rubyid__tag'>_tag</span><span class='rparen'>)</span>
287
+ <span class='id identifier rubyid_text'>text</span> <span class='op'>=</span> <span class='const'>CommentTag</span><span class='period'>.</span><span class='id identifier rubyid_format_docstring_as_comment'>format_docstring_as_comment</span><span class='lparen'>(</span><span class='id identifier rubyid_yard_object'>yard_object</span><span class='rparen'>)</span>
288
+ <span class='id identifier rubyid_text'>text</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\n</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_yard_object'>yard_object</span><span class='period'>.</span><span class='id identifier rubyid_source'>source</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
289
+ <span class='const'>ExampleTag</span><span class='period'>.</span><span class='id identifier rubyid_format_ruby'>format_ruby</span><span class='lparen'>(</span><span class='id identifier rubyid_text'>text</span><span class='rparen'>)</span>
290
+ <span class='kw'>end</span>
291
+ </code></pre>
297
292
 
298
293
  <h3 id="embed-a-ruby-value-as-a-ruby-code-block">Embed a Ruby value as a Ruby code block</h3>
299
294
 
300
295
  <p><strong>Usage:</strong></p>
301
296
 
302
- <p><code>ruby
303
- # @readme value
304
- </code></p>
297
+ <pre class="code ruby"><code class="ruby"><span class='comment'># @readme value
298
+ </span></code></pre>
305
299
 
306
300
  <p>This example <a href="https://github.com/mattruzicka/readme_yard/blob/main/lib/readme_yard/value_tag.rb">@readme value</a> tag embeds the below code snippet via the <code>{@value ReadmeYard::ValueTag::EXAMPLE}</code> markdown tag.</p>
307
301
 
308
- <p><code>ruby
309
- { key: "value" }.freeze
310
- </code></p>
302
+ <pre class="code ruby"><code class="ruby"><span class='lbrace'>{</span> <span class='label'>key:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>value</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span>
303
+ </code></pre>
311
304
 
312
305
  <h3 id="embed-a-ruby-string-as-normal-text">Embed a Ruby string as normal text</h3>
313
306
 
@@ -315,47 +308,48 @@ end
315
308
 
316
309
  <p>Because a <a href="https://github.com/mattruzicka/readme_yard/blob/main/lib/readme_yard/string_tag.rb">@readme string</a> tag:</p>
317
310
 
318
- <p><code>ruby
319
- # @readme string
320
- </code></p>
311
+ <pre class="code ruby"><code class="ruby"><span class='comment'># @readme string
312
+ </span></code></pre>
321
313
 
322
314
  <p>Is located above this constant:</p>
323
315
 
324
- <p><code>ruby
325
- XZAMPLE = &lt;&lt;~STRING
326
- I heard you like self-documenting Ruby, so I wrote
327
- self-documenting Ruby for your self-documenting Ruby.
328
- STRING
329
- </code></p>
316
+ <pre class="code ruby"><code class="ruby"><span class='const'>XZAMPLE</span> <span class='op'>=</span> <span class='heredoc_beg'>&lt;&lt;~STRING</span>
317
+ <span class='tstring_content'> I heard you like self-documenting Ruby, so I wrote
318
+ </span><span class='tstring_content'> self-documenting Ruby for your self-documenting Ruby.
319
+ </span><span class='heredoc_end'>STRING
320
+ </span></code></pre>
330
321
 
331
322
  <p>We see can see its string value as simple text below:</p>
332
323
 
333
324
  <p>I heard you like self-documenting Ruby, so I wrote
334
325
  self-documenting Ruby for your self-documenting Ruby.</p>
335
326
 
336
- <hr />
327
+ <hr>
337
328
 
338
329
  <h2 id="standalone-tag-usage">Standalone Tag Usage</h2>
339
330
 
340
- <p>While using the <code>@readme</code> tag in your source code is recommended because it makes the READMEs dependency on source code explicit, sometimes its useful to embed source code snippets directly without it. This is especially valuable when a source object can only contain one <code>@readme</code> tag, but you want to highlight multiple aspects of the object.</p>
331
+ <p>While using the <code>@readme</code> tag in your source code is recommended because it makes the README&#39;s dependency on source code explicit, sometimes it&#39;s useful to embed source code snippets directly without it. This is especially valuable when a source object can only contain one <code>@readme</code> tag, but you want to highlight multiple aspects of the object.</p>
341
332
 
342
333
  <p>You can use any of these tags directly in README_YARD.md without requiring a corresponding <code>@readme</code> tag in the source code:</p>
343
334
 
344
335
  <ul>
345
- <li><code>{@comment ObjectPath}</code> - Embeds comments only</li>
346
- <li><code>{@code ObjectPath}</code> - Embeds code only</li>
347
- <li><code>{@source ObjectPath}</code> - Embeds both comments and code</li>
348
- <li><code>{@value ObjectPath}</code> - Embeds a Ruby value as a Ruby code block</li>
349
- <li><code>{@string ObjectPath}</code> - Embeds a Ruby string as plain text</li>
336
+ <li><code>{@comment ObjectPath}</code> - Embeds comments only</li>
337
+ <li><code>{@code ObjectPath}</code> - Embeds code only</li>
338
+ <li><code>{@source ObjectPath}</code> - Embeds both comments and code</li>
339
+ <li><code>{@value ObjectPath}</code> - Embeds a Ruby value as a Ruby code block</li>
340
+ <li><code>{@string ObjectPath}</code> - Embeds a Ruby string as plain text</li>
350
341
  </ul>
351
342
 
352
- <p>For example, in the StringTag section above, we used both:
353
- - <code>{@code ReadmeYard::StringTag::XZAMPLE}</code> to show the constant definition
354
- - <code>{@string ReadmeYard::StringTag::XZAMPLE}</code> to display the string value as text</p>
343
+ <p>For example, in the StringTag section above, we used both:</p>
344
+
345
+ <ul>
346
+ <li><code>{@code ReadmeYard::StringTag::XZAMPLE}</code> to show the constant definition</li>
347
+ <li><code>{@string ReadmeYard::StringTag::XZAMPLE}</code> to display the string value as text</li>
348
+ </ul>
355
349
 
356
- <p>The standalone tag usage provides more flexibility when documenting your code and doesnt require modifications to the source files.</p>
350
+ <p>The standalone tag usage provides more flexibility when documenting your code and doesn&#39;t require modifications to the source files.</p>
357
351
 
358
- <hr />
352
+ <hr>
359
353
 
360
354
  <h2 id="example-tag">Example Tag</h2>
361
355
 
@@ -363,39 +357,37 @@ self-documenting Ruby for your self-documenting Ruby.</p>
363
357
 
364
358
  <p><strong>YARD</strong> syntax: <code>@example</code></p>
365
359
 
366
- <p>The Example Tag leverages YARDs standard <code>@example</code> tag syntax, allowing you to
360
+ <p>The Example Tag leverages YARD&#39;s standard <code>@example</code> tag syntax, allowing you to
367
361
  include example code in your README directly from source files. This saves time and
368
362
  ensures your README stays in sync with your YARD documentation</p>
369
363
 
370
364
  <p><strong>Usage:</strong></p>
371
365
 
372
- <p><code>ruby
373
- #
374
- # @example
375
- # ReadmeYard::ExampleTag.hello_world #=&gt; "Hello 🌎 🌍 🌏"
376
- #
377
- def hello_world
378
- "Hello 🌎 🌍 🌏"
379
- end
380
- </code></p>
366
+ <pre class="code ruby"><code class="ruby"><span class='comment'>#
367
+ </span><span class='comment'># @example
368
+ </span><span class='comment'># ReadmeYard::ExampleTag.hello_world #=&gt; &quot;Hello 🌎 🌍 🌏&quot;
369
+ </span><span class='comment'>#
370
+ </span><span class='kw'>def</span> <span class='id identifier rubyid_hello_world'>hello_world</span>
371
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Hello 🌎 🌍 🌏</span><span class='tstring_end'>&quot;</span></span>
372
+ <span class='kw'>end</span>
373
+ </code></pre>
381
374
 
382
- <p>The below example code is generated from <code>{@example ReadmeYard::ExampleTag.hello_world}</code> because, as you can see above, the hello_world class method has an <code>@example</code> tag.</p>
375
+ <p>The below example code is generated from <code>{@example ReadmeYard::ExampleTag.hello_world}</code> because, as you can see above, the &quot;hello_world&quot; class method has an <code>@example</code> tag.</p>
383
376
 
384
- <p><code>ruby
385
- ReadmeYard::ExampleTag.hello_world #=&gt; "Hello 🌎 🌍 🌏"
386
- </code></p>
377
+ <pre class="code ruby"><code class="ruby"><span class='const'><span class='object_link'><a href="ReadmeYard.html" title="ReadmeYard (class)">ReadmeYard</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="ReadmeYard/ExampleTag.html" title="ReadmeYard::ExampleTag (class)">ExampleTag</a></span></span><span class='period'>.</span><span class='id identifier rubyid_hello_world'><span class='object_link'><a href="ReadmeYard/ExampleTag.html#hello_world-class_method" title="ReadmeYard::ExampleTag.hello_world (method)">hello_world</a></span></span> <span class='comment'>#=&gt; &quot;Hello 🌎 🌍 🌏&quot;
378
+ </span></code></pre>
387
379
 
388
- <hr />
380
+ <hr>
389
381
 
390
382
  <h2 id="contributing">Contributing</h2>
391
383
 
392
- <p>Bug reports and pull requests are welcome on GitHub at https://github.com/mattruzicka/readme_yard.</p>
384
+ <p>Bug reports and pull requests are welcome on GitHub at <a href="https://github.com/mattruzicka/readme_yard">https://github.com/mattruzicka/readme_yard</a>.</p>
393
385
 
394
386
  <p>Thanks for reading me, the README that documents how to document the README with code that documents itself 🤯</p>
395
387
  </div></div>
396
388
 
397
389
  <div id="footer">
398
- Generated on Mon May 5 09:48:52 2025 by
390
+ Generated on Fri May 9 00:45:02 2025 by
399
391
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
400
392
  0.9.37 (ruby-3.4.2).
401
393
  </div>
@@ -100,7 +100,7 @@
100
100
  </div>
101
101
 
102
102
  <div id="footer">
103
- Generated on Mon May 5 09:48:52 2025 by
103
+ Generated on Fri May 9 00:45:02 2025 by
104
104
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
105
105
  0.9.37 (ruby-3.4.2).
106
106
  </div>
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ReadmeYard
4
- VERSION = "0.5.0"
4
+ VERSION = "0.6.0"
5
5
  DOCS_URL = "https://mattruzicka.github.io/readme_yard/"
6
6
  end
@@ -26,13 +26,14 @@ class ReadmeYard
26
26
  warn_about_supported_markdown
27
27
  readme_plugin_opts
28
28
  else
29
- readme_plugin_opts << "--markup markdown\n"
29
+ readme_plugin_opts << "--markup markdown\n--markup-provider redcarpet\n"
30
30
  end
31
31
  end
32
32
 
33
33
  def default_readme_plugin_opts(yardopts_text)
34
34
  readme_opts = +""
35
- readme_opts << "\n" unless yardopts_text.lines.last.include?("\n")
35
+ last_line = yardopts_text.lines.last
36
+ readme_opts << "\n" if last_line && !last_line.include?("\n")
36
37
  readme_opts << "--plugin readme\n"
37
38
  end
38
39
 
data/readme_yard.gemspec CHANGED
@@ -29,6 +29,7 @@ Gem::Specification.new do |spec|
29
29
 
30
30
  # Uncomment to register a new dependency of your gem
31
31
  spec.add_dependency "diffy", "~> 3.4"
32
+ spec.add_dependency "redcarpet", "~> 3.6"
32
33
  spec.add_dependency "tty-markdown", "~> 0.7"
33
34
  spec.add_dependency "yard", "~> 0.9"
34
35
  spec.add_dependency "yard-readme", "~> 0.5"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: readme_yard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Ruzicka
@@ -23,6 +23,20 @@ dependencies:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
25
  version: '3.4'
26
+ - !ruby/object:Gem::Dependency
27
+ name: redcarpet
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '3.6'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '3.6'
26
40
  - !ruby/object:Gem::Dependency
27
41
  name: tty-markdown
28
42
  requirement: !ruby/object:Gem::Requirement