readme_yard 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.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/.yardopts +1 -0
- data/CHANGELOG.md +12 -1
- data/Gemfile +3 -0
- data/Gemfile.lock +65 -15
- data/README.md +162 -52
- data/README_YARD.md +108 -34
- data/bin/readme +2 -2
- data/lib/readme_yard/code_tag.rb +28 -0
- data/lib/readme_yard/comment_tag.rb +14 -5
- data/lib/readme_yard/error.rb +2 -0
- data/lib/readme_yard/example_tag.rb +21 -3
- data/lib/readme_yard/logger.rb +8 -1
- data/lib/readme_yard/readme_tag.rb +15 -11
- data/lib/readme_yard/source_tag.rb +16 -4
- data/lib/readme_yard/string_tag.rb +86 -0
- data/lib/readme_yard/tag_registry.rb +21 -0
- data/lib/readme_yard/value_tag.rb +31 -0
- data/lib/readme_yard/version.rb +1 -1
- data/lib/readme_yard/yard_opts_manager.rb +49 -0
- data/lib/readme_yard.rb +38 -94
- data/readme_yard.gemspec +7 -3
- metadata +39 -12
- data/lib/readme_yard/object_tag.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 755f223afede15fbac8b87531730204494747aaf8b95302bf0cae4ca9a8822d3
|
4
|
+
data.tar.gz: b765382a63cf98480cf2e557f793272c046f18916313b8907875f0fa70e4ee30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcc797e2dd79799f06c8acfd1737b901f010b8b52300e77fa78cf0be48b249f43e3968a23a74cb5b8243072d17008e87a77ac77e91715c81724b7fc50bab5d82
|
7
|
+
data.tar.gz: 12bdfd98250616c6379d1563a92de7cc9ae3b436746f96057bf6f66feea3ba1dafc045a631579960ac0cc0fb829ea51dbf9df8aec5e94257cc270c07cc3fe72a
|
data/.rubocop.yml
CHANGED
data/.yardopts
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,15 @@
|
|
1
|
-
##
|
1
|
+
## 0.3.0 - 2025-05-04
|
2
|
+
|
3
|
+
- Update dependencies: upgraded yard-readme to 0.5.0, Ruby requirement to >= 3.0
|
4
|
+
- Add TagRegistry class to centralize tag management
|
5
|
+
- Update bundler and various gem dependencies
|
6
|
+
- Improve command-line argument handling in the readme executable
|
7
|
+
- Extract YardOptsManager to improve code organization
|
8
|
+
- Rename ObjectTag to SourceTag and rename old SourceTag to CodeTag
|
9
|
+
- Add new ValueTag and StringTag
|
10
|
+
- Add standalone tag support: enable embedding yard content in README without yard tags in the source code
|
11
|
+
- Rename format methods for consistency
|
12
|
+
- Rename `readme doc` command to `readme yard` for clarity and improved memorability
|
2
13
|
|
3
14
|
## 0.2.0 - 2021-08-08
|
4
15
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,44 +1,94 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
readme_yard (0.
|
4
|
+
readme_yard (0.3.0)
|
5
5
|
tty-markdown (~> 0.7)
|
6
|
-
yard
|
6
|
+
yard (~> 0.9)
|
7
|
+
yard-readme (~> 0.5)
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: https://rubygems.org/
|
10
11
|
specs:
|
11
|
-
|
12
|
-
|
12
|
+
ast (2.4.3)
|
13
|
+
date (3.4.1)
|
14
|
+
debug (1.10.0)
|
15
|
+
irb (~> 1.10)
|
16
|
+
reline (>= 0.3.8)
|
17
|
+
io-console (0.8.0)
|
18
|
+
irb (1.15.2)
|
19
|
+
pp (>= 0.6.0)
|
20
|
+
rdoc (>= 4.0.0)
|
21
|
+
reline (>= 0.4.2)
|
22
|
+
json (2.11.3)
|
23
|
+
kramdown (2.5.1)
|
24
|
+
rexml (>= 3.3.9)
|
25
|
+
language_server-protocol (3.17.0.4)
|
26
|
+
lint_roller (1.1.0)
|
27
|
+
parallel (1.27.0)
|
28
|
+
parser (3.3.8.0)
|
29
|
+
ast (~> 2.4.1)
|
30
|
+
racc
|
13
31
|
pastel (0.8.0)
|
14
32
|
tty-color (~> 0.5)
|
15
|
-
|
16
|
-
|
33
|
+
pp (0.6.2)
|
34
|
+
prettyprint
|
35
|
+
prettyprint (0.2.0)
|
36
|
+
prism (1.4.0)
|
37
|
+
psych (5.2.4)
|
38
|
+
date
|
39
|
+
stringio
|
40
|
+
racc (1.8.1)
|
41
|
+
rainbow (3.1.1)
|
42
|
+
rdoc (6.13.1)
|
43
|
+
psych (>= 4.0.0)
|
44
|
+
regexp_parser (2.10.0)
|
45
|
+
reline (0.6.1)
|
46
|
+
io-console (~> 0.5)
|
47
|
+
rexml (3.4.1)
|
48
|
+
rouge (4.5.2)
|
49
|
+
rubocop (1.75.4)
|
50
|
+
json (~> 2.3)
|
51
|
+
language_server-protocol (~> 3.17.0.2)
|
52
|
+
lint_roller (~> 1.1.0)
|
53
|
+
parallel (~> 1.10)
|
54
|
+
parser (>= 3.3.0.2)
|
55
|
+
rainbow (>= 2.2.2, < 4.0)
|
56
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
57
|
+
rubocop-ast (>= 1.44.0, < 2.0)
|
58
|
+
ruby-progressbar (~> 1.7)
|
59
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
60
|
+
rubocop-ast (1.44.1)
|
61
|
+
parser (>= 3.3.7.2)
|
62
|
+
prism (~> 1.4)
|
63
|
+
ruby-progressbar (1.13.0)
|
64
|
+
stringio (3.1.7)
|
17
65
|
strings (0.2.1)
|
18
66
|
strings-ansi (~> 0.2)
|
19
67
|
unicode-display_width (>= 1.5, < 3.0)
|
20
68
|
unicode_utils (~> 1.4)
|
21
69
|
strings-ansi (0.2.0)
|
22
70
|
tty-color (0.6.0)
|
23
|
-
tty-markdown (0.7.
|
71
|
+
tty-markdown (0.7.2)
|
24
72
|
kramdown (>= 1.16.2, < 3.0)
|
25
73
|
pastel (~> 0.8)
|
26
|
-
rouge (
|
74
|
+
rouge (>= 3.14, < 5.0)
|
27
75
|
strings (~> 0.2.0)
|
28
76
|
tty-color (~> 0.5)
|
29
77
|
tty-screen (~> 0.8)
|
30
|
-
tty-screen (0.8.
|
31
|
-
unicode-display_width (2.
|
78
|
+
tty-screen (0.8.2)
|
79
|
+
unicode-display_width (2.6.0)
|
32
80
|
unicode_utils (1.4.0)
|
33
|
-
yard (0.9.
|
34
|
-
yard-readme (0.
|
35
|
-
yard (~> 0.9.26)
|
81
|
+
yard (0.9.37)
|
82
|
+
yard-readme (0.5.0)
|
36
83
|
|
37
84
|
PLATFORMS
|
38
|
-
arm64-darwin-
|
85
|
+
arm64-darwin-24
|
39
86
|
|
40
87
|
DEPENDENCIES
|
88
|
+
debug
|
89
|
+
irb
|
41
90
|
readme_yard!
|
91
|
+
rubocop (~> 1.75, >= 1.75.4)
|
42
92
|
|
43
93
|
BUNDLED WITH
|
44
|
-
2.
|
94
|
+
2.6.8
|
data/README.md
CHANGED
@@ -1,23 +1,35 @@
|
|
1
1
|
# Readme Yard 🌿
|
2
2
|
[](https://badge.fury.io/rb/readme_yard)
|
3
|
-
[](https://codeclimate.com/github/mattruzicka/readme_yard/maintainability)
|
4
3
|
|
5
|
-
Build a better README with [YARD](https://yardoc.org)
|
6
|
-
|
7
|
-
without duplicating them.
|
4
|
+
Build a better README with [YARD](https://yardoc.org)
|
5
|
+
by generating it straight from the source.
|
8
6
|
|
9
|
-
This gem aims to minimize the effort needed to keep
|
10
|
-
|
7
|
+
This gem aims to minimize the effort needed to keep your
|
8
|
+
README, documentation, and source code synced, useful,
|
9
|
+
and correct. Among its features, it introduces the @readme tag
|
10
|
+
that enables you to embed code comments directly into README sections,
|
11
|
+
eliminating redundancy and keeping documentation consistent
|
12
|
+
across your codebase and project README.
|
11
13
|
|
12
|
-
|
13
|
-
template
|
14
|
+
Look at the [README_YARD.md](https://github.com/mattruzicka/readme_yard/blob/main/README_YARD.md)
|
15
|
+
template for this project to see how it works.
|
14
16
|
If you're reading the README, that means this text is here
|
15
|
-
because `{@readme ReadmeYard}` is in
|
16
|
-
and
|
17
|
+
because the custom `{@readme ReadmeYard}` markdown tag is in
|
18
|
+
README_YARD.md and `readme build` was run at the command line.
|
17
19
|
|
18
20
|
Here's the [full documentation](https://rubydoc.info/github/mattruzicka/readme_yard).
|
19
21
|
|
20
22
|
|
23
|
+
---
|
24
|
+
|
25
|
+
⚠️ **Generated file warning** – Edit README_YARD.md, not README.md. Changes to README.md will be lost when running `readme build`.
|
26
|
+
|
27
|
+
### Future Work
|
28
|
+
- Implement safeguards to prevent accidental edits to README.md
|
29
|
+
- Support bidirectional editing through git integration
|
30
|
+
|
31
|
+
[PRs are welcome](#contributing) for these improvements.
|
32
|
+
|
21
33
|
---
|
22
34
|
|
23
35
|
## Table of Contents
|
@@ -26,7 +38,7 @@ Here's the [full documentation](https://rubydoc.info/github/mattruzicka/readme_y
|
|
26
38
|
- [Command Line Usage](#command-line-usage)
|
27
39
|
- [Tag Usage](#tag-usage)
|
28
40
|
- [Readme Tag](#readme-tag)
|
29
|
-
- [
|
41
|
+
- [Standalone Tag Usage](#standalone-tag-usage)
|
30
42
|
- [Example Tag](#example-tag)
|
31
43
|
- [Contributing](#contributing)
|
32
44
|
|
@@ -34,13 +46,17 @@ Here's the [full documentation](https://rubydoc.info/github/mattruzicka/readme_y
|
|
34
46
|
|
35
47
|
## Installation
|
36
48
|
|
37
|
-
Add [gem "readme_yard"](https://rubygems.org/gems/readme_yard) to your
|
49
|
+
Add [gem "readme_yard"](https://rubygems.org/gems/readme_yard) to your Gemfile and run `bundle install` or install it yourself with: `gem install readme_yard`
|
50
|
+
|
51
|
+
**Note:** As of version 0.3.0, Readme Yard requires Ruby 3.0 or higher.
|
38
52
|
|
39
53
|
## Getting Started
|
40
54
|
|
41
|
-
Run `readme build` at the command line.
|
55
|
+
Run `readme build` at the command line. This creates a README_YARD.md file if there isn't one by copying your existing README.md file.
|
42
56
|
|
43
|
-
README_YARD.md is the template from which `readme build` generates the README.
|
57
|
+
README_YARD.md is the template from which `readme build` generates the README. Readme Yard adds the ability to embed and reference your source code in your README via README_YARD.md.
|
58
|
+
|
59
|
+
See [Tag Usage](#tag-usage).
|
44
60
|
|
45
61
|
---
|
46
62
|
|
@@ -50,102 +66,122 @@ README_YARD.md is the template from which `readme build` generates the README. I
|
|
50
66
|
|
51
67
|
`readme build` - Reads from README_YARD.md and writes to README.md.
|
52
68
|
|
53
|
-
`readme
|
69
|
+
`readme yard` - Same as `readme build` + generates yard docs.
|
54
70
|
|
55
71
|
|
56
72
|
---
|
57
73
|
|
58
74
|
## Tag Usage
|
59
75
|
|
60
|
-
Readme Yard uses
|
76
|
+
Readme Yard uses YARD tags and custom markdown tags. YARD tags live inside Ruby source code. The markdown tags live inside README_YARD.md.
|
61
77
|
|
62
|
-
|
78
|
+
When the Readme Yard build process encounters a tag in README_YARD.md, it searches the Ruby source code for its YARD tag counterpart, formats the output, and embeds it in the README file.
|
63
79
|
|
64
|
-
|
80
|
+
### Tag Reference Table
|
65
81
|
|
66
|
-
|
82
|
+
| Tag Type | YARD Syntax (in source code) | Markdown Syntax (in README_YARD.md) | Standalone Tag* | Purpose |
|
83
|
+
|----------|------------------------------|-------------------------------------|----------------|---------|
|
84
|
+
| Readme | `@readme` | `{@readme ObjectPath}` | N/A | General purpose tag to embed content from source code |
|
85
|
+
| Readme (comment) | `@readme comment` | `{@readme ObjectPath}` | `{@comment ObjectPath}` | Embeds only the comment from source code |
|
86
|
+
| Readme (code) | `@readme code` | `{@readme ObjectPath}` | `{@code ObjectPath}` | Embeds only code implementation |
|
87
|
+
| Readme (source) | `@readme source` | `{@readme ObjectPath}` | `{@source ObjectPath}` | Embeds both comments and code |
|
88
|
+
| Readme (value) | `@readme value` | `{@readme ObjectPath}` | `{@value ObjectPath}` | Embeds a Ruby value as a Ruby code block |
|
89
|
+
| Readme (string) | `@readme string` | `{@readme ObjectPath}` | `{@string ObjectPath}` | Embeds a Ruby string as normal text |
|
90
|
+
| Example | `@example` | `{@example ObjectPath}` | N/A | Embeds example code from YARD @example tags |
|
91
|
+
|
92
|
+
> *Standalone tags allow embedding content without requiring corresponding YARD tags in source code. See [Standalone Tag Usage](#standalone-tag-usage) for details.
|
67
93
|
|
68
94
|
### Examples
|
69
95
|
|
70
|
-
|
96
|
+
The next line is a code snippet if you're looking at [README.md](https://github.com/mattruzicka/README/blob/main/README_YARD.md) and `{@readme ReadmeYard::ExampleTag.hello_world}` if you're looking at [README_YARD.md](https://github.com/mattruzicka/readme_yard/blob/main/README_YARD.md).
|
71
97
|
|
72
98
|
```ruby
|
73
99
|
#
|
74
100
|
# @example
|
75
|
-
# ReadmeYard.hello_world #=> "Hello 🌎 🌍 🌏"
|
101
|
+
# ReadmeYard::ExampleTag.hello_world #=> "Hello 🌎 🌍 🌏"
|
76
102
|
#
|
103
|
+
def hello_world
|
104
|
+
"Hello 🌎 🌍 🌏"
|
105
|
+
end
|
77
106
|
```
|
78
107
|
|
79
108
|
|
80
|
-
The
|
109
|
+
The markdown tag tells Readme Yard to parse the `@readme` tag located above the `hello_world` class method located in [lib/readme_yard/example_tag.rb](https://github.com/mattruzicka/readme_yard/blob/main/lib/readme_yard/example_tag.rb).
|
81
110
|
|
82
111
|
To use another "meta" example, `{@readme ReadmeYard}` is used at the top of this project's README_YARD.md file to generate the first few sentences of this README. `ReadmeYard` references the class located in [lib/readme_yard.rb](https://github.com/mattruzicka/readme_yard/blob/main/lib/readme_yard.rb).
|
83
112
|
|
84
|
-
Last one, `{@readme ReadmeYard#command_line_usage}` is used to generate the "Command Line Usage" section above from the comments
|
113
|
+
Last one, `{@readme ReadmeYard#command_line_usage}` is used to generate the "Command Line Usage" section above from the comments of the `command_line_usage` instance method located in [lib/readme_yard.rb](https://github.com/mattruzicka/readme_yard/blob/main/lib/readme_yard.rb). 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.
|
85
114
|
|
86
115
|
---
|
87
116
|
|
88
117
|
## Readme Tag
|
89
118
|
|
90
|
-
**
|
91
|
-
|
92
|
-
**YARD Tag** syntax: `@example <name>`
|
119
|
+
**Markdown** syntax: `{@readme ObjectPath}`
|
93
120
|
|
94
|
-
|
95
|
-
will be embedded in the final output.
|
121
|
+
**YARD** syntax: `@example <name>`
|
96
122
|
|
97
|
-
|
98
|
-
|
123
|
+
By default, only the text nested under a @readme tag
|
124
|
+
will be embedded in the final output. The default
|
125
|
+
embed behavior can be changed through the use of tag names.
|
99
126
|
|
100
127
|
|
101
|
-
|
128
|
+
### Embed comments
|
102
129
|
|
103
|
-
## Readme YARD Tags
|
104
130
|
|
131
|
+
**Usage:**
|
105
132
|
|
106
|
-
|
107
|
-
|
108
|
-
|
133
|
+
```ruby
|
134
|
+
# @readme comment
|
135
|
+
```
|
109
136
|
|
110
137
|
|
111
|
-
|
138
|
+
This example [@readme comment](https://github.com/mattruzicka/readme_yard/blob/main/lib/readme_yard/comment_tag.rb) tag embeds the below code snippet via the `{@readme ReadmeYard::CommentTag.format_tag}` markdown tag.
|
112
139
|
|
113
140
|
```ruby
|
114
141
|
#
|
115
142
|
# This comment is in the README because `@readme comment`
|
116
|
-
# is below
|
143
|
+
# is below (in the source code).
|
117
144
|
#
|
118
145
|
```
|
119
146
|
|
120
147
|
|
121
|
-
###
|
148
|
+
### Embed Ruby code
|
122
149
|
|
123
|
-
```@readme source``` - Embeds the source.
|
124
150
|
|
151
|
+
**Usage:**
|
125
152
|
|
126
|
-
|
153
|
+
```ruby
|
154
|
+
# @readme code
|
155
|
+
```
|
156
|
+
|
157
|
+
|
158
|
+
This example [@readme code](https://github.com/mattruzicka/readme_yard/blob/main/lib/readme_yard/code_tag.rb) tag embeds the below code snippet via the `{@readme ReadmeYard::CodeTag.format_tag}` markdown tag.
|
127
159
|
|
128
160
|
```ruby
|
129
|
-
def
|
161
|
+
def format_tag(yard_object, _tag)
|
130
162
|
ExampleTag.format_ruby(yard_object.source)
|
131
163
|
end
|
132
164
|
```
|
133
165
|
|
134
166
|
|
167
|
+
### Embed Ruby comments and code
|
135
168
|
|
136
|
-
### Object Tag
|
137
169
|
|
138
|
-
|
170
|
+
**Usage:**
|
139
171
|
|
172
|
+
```ruby
|
173
|
+
# @readme source
|
174
|
+
```
|
140
175
|
|
141
|
-
|
176
|
+
|
177
|
+
This example [@readme source](https://github.com/mattruzicka/readme_yard/blob/main/lib/readme_yard/source_tag.rb) tag embeds the below code snippet via the `{@readme ReadmeYard::SourceTag.format_tag}` markdown tag.
|
142
178
|
|
143
179
|
```ruby
|
144
180
|
#
|
145
|
-
#
|
146
|
-
# because `@readme
|
181
|
+
# The comment and code for ReadmeYard::SourceTag#format_tag
|
182
|
+
# is in the README because `@readme source` is below (in the source code).
|
147
183
|
#
|
148
|
-
def
|
184
|
+
def format_tag(yard_object, _tag)
|
149
185
|
text = CommentTag.format_docstring_as_comment(yard_object)
|
150
186
|
text << "\n#{yard_object.source}"
|
151
187
|
ExampleTag.format_ruby(text)
|
@@ -153,27 +189,99 @@ end
|
|
153
189
|
```
|
154
190
|
|
155
191
|
|
192
|
+
### Embed a Ruby value as a Ruby code block
|
193
|
+
|
194
|
+
|
195
|
+
**Usage:**
|
196
|
+
|
197
|
+
```ruby
|
198
|
+
# @readme value
|
199
|
+
```
|
200
|
+
|
201
|
+
|
202
|
+
This example [@readme value](https://github.com/mattruzicka/readme_yard/blob/main/lib/readme_yard/value_tag.rb) tag embeds the below code snippet via the `{@value ReadmeYard::ValueTag::EXAMPLE}` markdown tag.
|
203
|
+
|
204
|
+
```ruby
|
205
|
+
{ key: "value" }.freeze
|
206
|
+
```
|
207
|
+
|
208
|
+
### Embed a Ruby string as normal text
|
209
|
+
|
210
|
+
|
211
|
+
**Usage:**
|
212
|
+
|
213
|
+
Because a [@readme string](https://github.com/mattruzicka/readme_yard/blob/main/lib/readme_yard/string_tag.rb) tag:
|
214
|
+
|
215
|
+
```ruby
|
216
|
+
# @readme string
|
217
|
+
```
|
218
|
+
|
219
|
+
|
220
|
+
Is located above this constant:
|
221
|
+
|
222
|
+
```ruby
|
223
|
+
XZAMPLE = <<~STRING
|
224
|
+
I heard you like self-documenting Ruby, so I wrote
|
225
|
+
self-documenting Ruby for your self-documenting Ruby.
|
226
|
+
STRING
|
227
|
+
```
|
228
|
+
|
229
|
+
|
230
|
+
We see can see its string value as simple text below:
|
231
|
+
|
232
|
+
I heard you like self-documenting Ruby, so I wrote
|
233
|
+
self-documenting Ruby for your self-documenting Ruby.
|
234
|
+
|
235
|
+
---
|
236
|
+
|
237
|
+
## Standalone Tag Usage
|
238
|
+
|
239
|
+
While using the `@readme` tag in your source code is recommended because it makes the README's dependency on source code explicit, sometimes it's useful to embed source code snippets directly without it. This is especially valuable when a source object can only contain one `@readme` tag, but you want to highlight multiple aspects of the object.
|
240
|
+
|
241
|
+
You can use any of these tags directly in README_YARD.md without requiring a corresponding `@readme` tag in the source code:
|
242
|
+
|
243
|
+
- `{@comment ObjectPath}` - Embeds comments only
|
244
|
+
- `{@code ObjectPath}` - Embeds code only
|
245
|
+
- `{@source ObjectPath}` - Embeds both comments and code
|
246
|
+
- `{@value ObjectPath}` - Embeds a Ruby value as a Ruby code block
|
247
|
+
- `{@string ObjectPath}` - Embeds a Ruby string as plain text
|
248
|
+
|
249
|
+
For example, in the StringTag section above, we used both:
|
250
|
+
- `{@code ReadmeYard::StringTag::XZAMPLE}` to show the constant definition
|
251
|
+
- `{@string ReadmeYard::StringTag::XZAMPLE}` to display the string value as text
|
252
|
+
|
253
|
+
The standalone tag usage provides more flexibility when documenting your code and doesn't require modifications to the source files.
|
156
254
|
|
157
255
|
---
|
158
256
|
|
159
257
|
## Example Tag
|
160
258
|
|
161
|
-
**
|
259
|
+
**Markdown** syntax: `{@example ObjectPath}`
|
260
|
+
|
261
|
+
**YARD** syntax: `@example`
|
262
|
+
|
263
|
+
The Example Tag leverages YARD's standard `@example` tag syntax, allowing you to
|
264
|
+
include example code in your README directly from source files. This saves time and
|
265
|
+
ensures your README stays in sync with your YARD documentation
|
162
266
|
|
163
|
-
|
267
|
+
|
268
|
+
**Usage:**
|
164
269
|
|
165
270
|
```ruby
|
166
271
|
#
|
167
272
|
# @example
|
168
|
-
# ReadmeYard.hello_world #=> "Hello 🌎 🌍 🌏"
|
273
|
+
# ReadmeYard::ExampleTag.hello_world #=> "Hello 🌎 🌍 🌏"
|
169
274
|
#
|
275
|
+
def hello_world
|
276
|
+
"Hello 🌎 🌍 🌏"
|
277
|
+
end
|
170
278
|
```
|
171
279
|
|
172
280
|
|
173
|
-
|
281
|
+
The below example code is generated from `{@example ReadmeYard::ExampleTag.hello_world}` because, as you can see above, the "hello_world" class method has an `@example` tag.
|
174
282
|
|
175
283
|
```ruby
|
176
|
-
ReadmeYard.hello_world #=> "Hello 🌎 🌍 🌏"
|
284
|
+
ReadmeYard::ExampleTag.hello_world #=> "Hello 🌎 🌍 🌏"
|
177
285
|
```
|
178
286
|
|
179
287
|
|
@@ -183,6 +291,8 @@ ReadmeYard.hello_world #=> "Hello 🌎 🌍 🌏"
|
|
183
291
|
|
184
292
|
Bug reports and pull requests are welcome on GitHub at https://github.com/mattruzicka/yard-readme.
|
185
293
|
|
294
|
+
If you're interested in contributing, but don't know where to get started, feel free to message me on twitter at [@mattruzicka](https://twitter.com/mattruzicka). I have a lot of ideas!
|
295
|
+
|
186
296
|
Thanks for taking the time to think about me, the README.
|
187
297
|
|
188
298
|
🌿 🥏 🌱 ⚽
|