yard-markdown 0.4.1 → 0.5.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/.yardopts +0 -7
- data/README.md +20 -9
- data/Rakefile +19 -0
- data/example/rdoc/Bird.md +32 -0
- data/example/rdoc/Duck.md +60 -0
- data/example/rdoc/Waterfowl.md +11 -0
- data/example/rdoc/index.csv +21 -0
- data/example/yard/Aquatic.md +13 -0
- data/example/{Fish.md → yard/Fish.md} +10 -9
- data/example/{Salmon.md → yard/Salmon.md} +23 -19
- data/templates/default/fulldoc/markdown/setup.rb +11 -22
- metadata +11 -10
- data/example/Aquatic.md +0 -18
- /data/example/{index.csv → yard/index.csv} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3bf19f52aa053b77b3bdfa88b447e7db00c746135a47b77e81e2a08ceb4367a
|
4
|
+
data.tar.gz: 8a141a935807d808abec2fa5f2e6d690cfb0c9ec70e89fc0709e7a39f60fb697
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d53e7cd3f76693122642ec6196bf8e49f11b2b5457ebb0942be702e33efe25348141580188bb00dfc9846b5766ee412e14c9c059e119358ab79c1a0f828e30c1
|
7
|
+
data.tar.gz: 02d47f00d6408f1d645ac0d46936e2734c89f1c853632d88b4217d0bb2985993ddcd6d99dbe38de18ee40a858b1441a35b44c3ce7e6ea2161b4a6705e2dcb540
|
data/.yardopts
CHANGED
data/README.md
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
# Yard::Markdown
|
2
2
|
|
3
|
-
Yard plugin to
|
3
|
+
Yard plugin to output markdown documentation.
|
4
|
+
|
5
|
+
## Motivation
|
6
|
+
Markdown has become the de-facto documentation standard. I heavily rely on Obsidian to render my storage of markdown notes. But markdown is used not just for scribbles, supported is far and wide. We can render markdown file on any device, probably even on thermometer with a screen. But also everyone knows enough markdown to be dangerous (or productive).
|
7
|
+
It's a pitty that rdoc and yard can't output a proper markdown file. I would like to change that.
|
4
8
|
|
5
9
|
## Goals:
|
6
10
|
- Compatible with Github Flavored Markdown
|
11
|
+
- Produce .csv index file
|
7
12
|
- Mimick yard html layout where it makes sense to maintain familiarity
|
8
|
-
- Produce .csv index file alonside markdown documentation to act as file index
|
9
13
|
|
10
14
|
## Usage
|
11
15
|
Yard doesn't load plugin by default, so you need to load plugin through `~/.yard/config`:
|
@@ -24,14 +28,21 @@ gem install yard-markdown
|
|
24
28
|
|
25
29
|
Run `yardoc --format=markdown` to generate markdown documentation.
|
26
30
|
|
27
|
-
##
|
28
|
-
|
31
|
+
## Note on RDoc support
|
32
|
+
It seems important to note, that yard claims to have support for RDoc. That support is certainly present, but output for rdoc is dramatically different. A lot of useful information seems lost in the process.
|
33
|
+
|
34
|
+
If you know how to improve that, please get in touch or submit a patch.
|
35
|
+
|
36
|
+
So in meantime, there is work going on a competing gem for RDoc and it's called [rdoc-mardown gem](https://github.com/skatkov/rdoc-markdown/).
|
37
|
+
|
38
|
+
## Note on index.csv file
|
39
|
+
This gem emits index of all markdown files in a index.csv file.
|
40
|
+
|
41
|
+
There are decent tools that offer search through structured plain-text files. But my expectation is that nobody will use CSV as an actual search index, but rather import it into something that performs this function better.
|
42
|
+
|
43
|
+
In my personal use-case, I use SQLite. All other databases seem to have a good support for CSV imports.
|
29
44
|
|
30
45
|
## Testing
|
31
46
|
Unit tests can't really test this gem properly. So it's semi-manual process of making changes and reviewing output.
|
32
47
|
|
33
|
-
|
34
|
-
`yardoc example_rdoc.rb` -> outputs everything into example/ folder.
|
35
|
-
|
36
|
-
### Testing Yard conversion to markdown:
|
37
|
-
`yardoc example_yard.rb` -> outputs everything into example/ folder.
|
48
|
+
Easiest way to test is to run `rake generate_example` and check output in `example` directory.
|
data/Rakefile
CHANGED
@@ -10,3 +10,22 @@ Rake::TestTask.new(:test) do |t|
|
|
10
10
|
end
|
11
11
|
|
12
12
|
task default: %i[test stree:write]
|
13
|
+
|
14
|
+
|
15
|
+
namespace :examples do
|
16
|
+
desc "Generate basic example documentation using yard-markdown plugin"
|
17
|
+
task :generate do
|
18
|
+
Rake::Task["examples:yard"].invoke
|
19
|
+
Rake::Task["examples:rdoc"].invoke
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "Generate example documentation for code annotated with yard"
|
23
|
+
task :yard do
|
24
|
+
sh "yardoc --output-dir example/yard example_yard.rb"
|
25
|
+
end
|
26
|
+
|
27
|
+
desc "Generate example documentation for code annotated with rdoc"
|
28
|
+
task :rdoc do
|
29
|
+
sh "yardoc --output-dir example/rdoc example_rdoc.rb"
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# Class: Bird
|
2
|
+
**Inherits:** Object
|
3
|
+
|
4
|
+
|
5
|
+
The base class for all birds.
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
#Instance Methods
|
10
|
+
## _fly_impl(_direction, _velocity) [](#method-i-_fly_impl)
|
11
|
+
:nodoc:
|
12
|
+
|
13
|
+
## fly(direction, velocity) [](#method-i-fly)
|
14
|
+
Fly somewhere.
|
15
|
+
|
16
|
+
Flying is the most critical feature of birds.
|
17
|
+
|
18
|
+
:args: direction, velocity
|
19
|
+
|
20
|
+
:call-seq:
|
21
|
+
Bird.fly(symbol, number) -> bool
|
22
|
+
Bird.fly(string, number) -> bool
|
23
|
+
|
24
|
+
# Example
|
25
|
+
|
26
|
+
fly(:south, 70)
|
27
|
+
|
28
|
+
## speak() [](#method-i-speak)
|
29
|
+
Produce some noise. -- FIXME: maybe extract this to a base class `Animal`? ++
|
30
|
+
|
31
|
+
**@yield** ["tweet"]
|
32
|
+
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# Class: Duck
|
2
|
+
**Inherits:** Object
|
3
|
+
|
4
|
+
**Extended by:** Animal
|
5
|
+
|
6
|
+
**Includes:** Waterfowl
|
7
|
+
|
8
|
+
|
9
|
+
A duck is a Waterfowl Bird.
|
10
|
+
|
11
|
+
Features:
|
12
|
+
|
13
|
+
bird::
|
14
|
+
|
15
|
+
* speak
|
16
|
+
* fly
|
17
|
+
|
18
|
+
waterfowl::
|
19
|
+
|
20
|
+
* swim
|
21
|
+
|
22
|
+
|
23
|
+
# Class Methods
|
24
|
+
## rubber_ducks() [](#method-c-rubber_ducks)
|
25
|
+
**@return** [Array<Duck>] list of all rubber ducks
|
26
|
+
|
27
|
+
# Attributes
|
28
|
+
## domestic[RW] [](#attribute-i-domestic)
|
29
|
+
True for domestic ducks.
|
30
|
+
|
31
|
+
## rubber[RW] [](#attribute-i-rubber)
|
32
|
+
True for rubber ducks.
|
33
|
+
|
34
|
+
|
35
|
+
#Instance Methods
|
36
|
+
## initialize(domestic, rubber) [](#method-i-initialize)
|
37
|
+
Creates a new duck.
|
38
|
+
|
39
|
+
**@param** [Boolean]
|
40
|
+
|
41
|
+
**@param** [Boolean]
|
42
|
+
|
43
|
+
**@return** [Duck] a new instance of Duck
|
44
|
+
|
45
|
+
## speak() [](#method-i-speak)
|
46
|
+
Duck overrides generic implementation.
|
47
|
+
|
48
|
+
**@yield** [speech]
|
49
|
+
|
50
|
+
## swim() [](#method-i-swim)
|
51
|
+
Swimming helper.
|
52
|
+
|
53
|
+
## useful?() [](#method-i-useful?)
|
54
|
+
Checks if this duck is a useful one.
|
55
|
+
|
56
|
+
:call-seq:
|
57
|
+
Bird.useful? -> bool
|
58
|
+
|
59
|
+
**@return** [Boolean]
|
60
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
name,type,path
|
2
|
+
Waterfowl,Module,Waterfowl.md
|
3
|
+
Waterfowl.DEFAULT_DUCK_VELOCITY,Constant,Waterfowl.md#constant-DEFAULT_DUCK_VELOCITY
|
4
|
+
Waterfowl.DEFAULT_SPEED,Constant,Waterfowl.md#constant-DEFAULT_SPEED
|
5
|
+
Waterfowl.swim,Method,Waterfowl.md#method-i-swim
|
6
|
+
Bird,Class,Bird.md
|
7
|
+
Bird.DEFAULT_DUCK_VELOCITY,Constant,Bird.md#constant-DEFAULT_DUCK_VELOCITY
|
8
|
+
Bird.DEFAULT_SPEED,Constant,Bird.md#constant-DEFAULT_SPEED
|
9
|
+
Bird._fly_impl,Method,Bird.md#method-i-_fly_impl
|
10
|
+
Bird.fly,Method,Bird.md#method-i-fly
|
11
|
+
Bird.speak,Method,Bird.md#method-i-speak
|
12
|
+
Duck,Class,Duck.md
|
13
|
+
Duck.DEFAULT_DUCK_VELOCITY,Constant,Duck.md#constant-DEFAULT_DUCK_VELOCITY
|
14
|
+
Duck.DEFAULT_SPEED,Constant,Duck.md#constant-DEFAULT_SPEED
|
15
|
+
Duck.initialize,Method,Duck.md#method-i-initialize
|
16
|
+
Duck.speak,Method,Duck.md#method-i-speak
|
17
|
+
Duck.swim,Method,Duck.md#method-i-swim
|
18
|
+
Duck.useful?,Method,Duck.md#method-i-useful?
|
19
|
+
Duck.rubber_ducks,Method,Duck.md#method-c-rubber_ducks
|
20
|
+
domestic,Attribute,Duck.md#attribute-i-domestic
|
21
|
+
rubber,Attribute,Duck.md#attribute-i-rubber
|
@@ -1,33 +1,34 @@
|
|
1
1
|
# Class: Fish
|
2
2
|
**Inherits:** Object
|
3
3
|
|
4
|
-
**Defined in:** example_yard.rb
|
5
4
|
|
6
5
|
The base class for all fish.
|
7
6
|
|
8
|
-
|
7
|
+
|
8
|
+
|
9
|
+
#Instance Methods
|
9
10
|
## make_sound() [](#method-i-make_sound)
|
10
11
|
Make a sound.
|
11
12
|
|
12
13
|
**@return** [void]
|
14
|
+
|
13
15
|
**@yield** [sound] The sound produced by the fish
|
16
|
+
|
14
17
|
**@yieldparam** [String] The actual sound
|
18
|
+
|
15
19
|
## swim(direction, speed) [](#method-i-swim)
|
16
20
|
Swim in a specific direction.
|
17
21
|
|
18
22
|
Swimming is the most critical feature of fish.
|
19
23
|
|
20
24
|
**@param** [Symbol, String] The direction to swim
|
25
|
+
|
21
26
|
**@param** [Integer] The speed at which to swim
|
27
|
+
|
22
28
|
**@return** [Boolean] Whether the swim was successful
|
23
29
|
|
30
|
+
|
24
31
|
**@example**
|
25
32
|
```ruby
|
26
33
|
swim(:north, 30)
|
27
|
-
```
|
28
|
-
|
29
|
-
# Constants
|
30
|
-
| Name | Default Value |
|
31
|
-
| --- | --- |
|
32
|
-
| [DEFAULT_SALMON_SPEED](#constant-DEFAULT_SALMON_SPEED) | 20 |
|
33
|
-
| [MAX_DEPTH](#constant-MAX_DEPTH) | 500 |
|
34
|
+
```
|
@@ -3,7 +3,6 @@
|
|
3
3
|
|
4
4
|
**Includes:** Aquatic
|
5
5
|
|
6
|
-
**Defined in:** example_yard.rb
|
7
6
|
|
8
7
|
A salmon is an Aquatic Fish.
|
9
8
|
|
@@ -15,42 +14,47 @@ A salmon is an Aquatic Fish.
|
|
15
14
|
* **Aquatic**
|
16
15
|
* swim (overridden)
|
17
16
|
|
18
|
-
|
17
|
+
|
18
|
+
# Class Methods
|
19
|
+
## wild_salmon() [](#method-c-wild_salmon)
|
20
|
+
**@return** [Array<Salmon>] List of all wild salmon
|
21
|
+
|
22
|
+
# Attributes
|
23
|
+
## farmed[RW] [](#attribute-i-farmed)
|
24
|
+
|
25
|
+
**@return** [Boolean] True for farmed salmon
|
26
|
+
|
27
|
+
## wild[RW] [](#attribute-i-wild)
|
28
|
+
|
29
|
+
**@return** [Boolean] True for wild salmon
|
30
|
+
|
31
|
+
|
32
|
+
#Instance Methods
|
19
33
|
## initialize(farmed, wild) [](#method-i-initialize)
|
20
34
|
Creates a new salmon.
|
21
35
|
|
22
36
|
**@param** [Boolean] Whether the salmon is farmed
|
37
|
+
|
23
38
|
**@param** [Boolean] Whether the salmon is wild
|
39
|
+
|
24
40
|
**@return** [Salmon] a new instance of Salmon
|
41
|
+
|
25
42
|
## make_sound() [](#method-i-make_sound)
|
26
43
|
Salmon overrides generic implementation.
|
27
44
|
|
28
45
|
**@return** [void]
|
46
|
+
|
29
47
|
**@yield** [sound] The sound produced by the salmon
|
48
|
+
|
30
49
|
**@yieldparam** [String] The actual sound
|
50
|
+
|
31
51
|
## sustainable?() [](#method-i-sustainable?)
|
32
52
|
Checks if this salmon is sustainable.
|
33
53
|
|
34
54
|
**@return** [Boolean] Whether the salmon is sustainable
|
55
|
+
|
35
56
|
## swim() [](#method-i-swim)
|
36
57
|
Swim in the water.
|
37
58
|
|
38
59
|
**@return** [void]
|
39
60
|
|
40
|
-
# Public Class Methods
|
41
|
-
## wild_salmon() [](#method-c-wild_salmon)
|
42
|
-
**@return** [Array<Salmon>] List of all wild salmon
|
43
|
-
|
44
|
-
# Attributes
|
45
|
-
## farmed[RW] [](#attribute-i-farmed)
|
46
|
-
|
47
|
-
**@return** [Boolean] True for farmed salmon
|
48
|
-
## wild[RW] [](#attribute-i-wild)
|
49
|
-
|
50
|
-
**@return** [Boolean] True for wild salmon
|
51
|
-
|
52
|
-
# Constants
|
53
|
-
| Name | Default Value |
|
54
|
-
| --- | --- |
|
55
|
-
| [DEFAULT_SALMON_SPEED](#constant-DEFAULT_SALMON_SPEED) | 20 |
|
56
|
-
| [MAX_DEPTH](#constant-MAX_DEPTH) | 500 |
|
@@ -104,24 +104,13 @@ def serialize(object)
|
|
104
104
|
<% if (mix = run_verifier(object.mixins(scope))).size > 0 %>
|
105
105
|
**<%= name %>:** <%= mix.sort_by {|o| o.path }.join(", ") %>
|
106
106
|
<% end %><% end %>
|
107
|
-
<% unless object.root? %>
|
108
|
-
**Defined in:** <%= object.file ? object.file.sub(Dir.pwd, "") : "(unknown)" %>
|
109
|
-
<% end %>
|
110
107
|
|
111
108
|
<%= rdoc_to_md object.docstring %>
|
112
109
|
|
113
110
|
<%= render_tags object %>
|
114
|
-
<% if (insmeths = public_instance_methods(object)).size > 0 %>
|
115
|
-
# Public Instance Methods
|
116
|
-
<% insmeths.each do |item| %>
|
117
|
-
## <%= item.name(false) %>(<%= item.parameters.map {|p| p.join("") }.join(", ")%>) [](#<%=aref(item)%>)
|
118
|
-
<%= rdoc_to_md item.docstring %>
|
119
|
-
|
120
|
-
<%= render_tags item %>
|
121
|
-
<% end %><% end %>
|
122
111
|
|
123
112
|
<% if (pubmeths = public_class_methods(object)).size > 0 %>
|
124
|
-
#
|
113
|
+
# Class Methods
|
125
114
|
<% pubmeths.each do |item| %>
|
126
115
|
## <%= item.name(false) %>(<%= item.parameters.map {|p| p.join(" ") }.join(", ") %>) [](#<%=aref(item)%>)
|
127
116
|
<%= rdoc_to_md item.docstring %>
|
@@ -135,15 +124,15 @@ def serialize(object)
|
|
135
124
|
|
136
125
|
<%= render_tags item %>
|
137
126
|
<% end %><% end %>
|
138
|
-
|
139
|
-
<%
|
140
|
-
#
|
141
|
-
<%
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
<% end %><% end
|
127
|
+
|
128
|
+
<% if (insmeths = public_instance_methods(object)).size > 0 %>
|
129
|
+
# Instance Methods
|
130
|
+
<% insmeths.each do |item| %>
|
131
|
+
## <%= item.name(false) %>(<%= item.parameters.map {|p| p.join("") }.join(", ")%>) [](#<%=aref(item)%>)
|
132
|
+
<%= rdoc_to_md item.docstring %>
|
133
|
+
|
134
|
+
<%= render_tags item %>
|
135
|
+
<% end %><% end %>',
|
147
136
|
trim_mode: "<>",
|
148
137
|
)
|
149
138
|
|
@@ -179,7 +168,7 @@ def render_tags(object)
|
|
179
168
|
result = String.new("")
|
180
169
|
object.tags.each do |tag|
|
181
170
|
result << if !(tag.tag_name == "example")
|
182
|
-
"**@#{tag.tag_name}** [#{tag.types&.join(', ')}] #{tag.text}\n"
|
171
|
+
"**@#{tag.tag_name}** [#{tag.types&.join(', ')}] #{tag.text}\n\n"
|
183
172
|
else
|
184
173
|
""
|
185
174
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard-markdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stanislav (Stas) Katkov
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
10
|
+
date: 2024-12-28 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: yard
|
@@ -51,10 +50,14 @@ files:
|
|
51
50
|
- LICENSE.txt
|
52
51
|
- README.md
|
53
52
|
- Rakefile
|
54
|
-
- example/
|
55
|
-
- example/
|
56
|
-
- example/
|
57
|
-
- example/index.csv
|
53
|
+
- example/rdoc/Bird.md
|
54
|
+
- example/rdoc/Duck.md
|
55
|
+
- example/rdoc/Waterfowl.md
|
56
|
+
- example/rdoc/index.csv
|
57
|
+
- example/yard/Aquatic.md
|
58
|
+
- example/yard/Fish.md
|
59
|
+
- example/yard/Salmon.md
|
60
|
+
- example/yard/index.csv
|
58
61
|
- example_rdoc.rb
|
59
62
|
- example_yard.rb
|
60
63
|
- lib/yard-markdown.rb
|
@@ -66,7 +69,6 @@ licenses:
|
|
66
69
|
metadata:
|
67
70
|
homepage_uri: https://poshtui.com
|
68
71
|
source_code_uri: https://github.com/skatkov/yard-markdown
|
69
|
-
post_install_message:
|
70
72
|
rdoc_options: []
|
71
73
|
require_paths:
|
72
74
|
- lib
|
@@ -81,8 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
83
|
- !ruby/object:Gem::Version
|
82
84
|
version: '0'
|
83
85
|
requirements: []
|
84
|
-
rubygems_version: 3.
|
85
|
-
signing_key:
|
86
|
+
rubygems_version: 3.6.2
|
86
87
|
specification_version: 4
|
87
88
|
summary: yard plugin to generate markdown documentation
|
88
89
|
test_files: []
|
data/example/Aquatic.md
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# Module: Aquatic
|
2
|
-
|
3
|
-
**Defined in:** example_yard.rb
|
4
|
-
|
5
|
-
A mixin for aquatic creatures.
|
6
|
-
|
7
|
-
# Public Instance Methods
|
8
|
-
## swim() [](#method-i-swim)
|
9
|
-
Swim in the water.
|
10
|
-
|
11
|
-
**@return** [void]
|
12
|
-
|
13
|
-
|
14
|
-
# Constants
|
15
|
-
| Name | Default Value |
|
16
|
-
| --- | --- |
|
17
|
-
| [DEFAULT_SALMON_SPEED](#constant-DEFAULT_SALMON_SPEED) | 20 |
|
18
|
-
| [MAX_DEPTH](#constant-MAX_DEPTH) | 500 |
|
File without changes
|