yard-markdown 0.9.1 → 0.10.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 63e026f1e1784ecb9ed593de1a380099db8d9e3712d20d5d3d72c1c69e199ca5
|
|
4
|
+
data.tar.gz: ee10fb76b63e7a21478cf4e9c701cf63f7634812b09c7a51dacdf4a95bc42f6c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a97ef87f724a9ddeeb9ae9e62fe778a63cfd206eb2e43023848d21f3fe64e258a3a3a8ce12fc2c75534342689588cf5d1c9e1ff92dbbc97ca320f345438551ca
|
|
7
|
+
data.tar.gz: cc29ea0d44aae4d42755d90b39ebbd493ff4f1d69f0348818cd6c9adc82baaca8d7cdd2092b9f2a8131c1079b78ff5b09b3ca24dc0d4b24be8e906e74138cc11
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,11 @@ This format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
|
|
|
5
5
|
|
|
6
6
|
## Unreleased
|
|
7
7
|
|
|
8
|
+
### 0.10.0
|
|
9
|
+
|
|
10
|
+
- Render optional keyword parameters with valid Ruby syntax (for example, `read_timeout: nil` instead of `read_timeout: = nil`).
|
|
11
|
+
- Preserve option names, types, descriptions, and defaults when rendering YARD `@option` tags.
|
|
12
|
+
|
|
8
13
|
## 0.9.1
|
|
9
14
|
|
|
10
15
|
- Include full filenames for files, not just titles
|
data/README.md
CHANGED
|
@@ -2,14 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Yard plugin to output markdown documentation.
|
|
4
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.
|
|
8
|
-
|
|
9
5
|
## Goals:
|
|
10
6
|
- Compatible with Github Flavored Markdown
|
|
11
7
|
- Produce .csv index file
|
|
12
|
-
- Mimick
|
|
8
|
+
- Mimick html layout where it makes sense to maintain familiarity
|
|
13
9
|
|
|
14
10
|
## Usage
|
|
15
11
|
Install a plugin
|
|
@@ -21,7 +21,10 @@ module YARD
|
|
|
21
21
|
# @return [String] Parenthesized method signature.
|
|
22
22
|
def self.method_signature(method_object)
|
|
23
23
|
rendered = Array(method_object.parameters).map do |name, default|
|
|
24
|
-
default.to_s.empty?
|
|
24
|
+
next name if default.to_s.empty?
|
|
25
|
+
|
|
26
|
+
separator = name.end_with?(":") ? " " : " = "
|
|
27
|
+
"#{name}#{separator}#{default}"
|
|
25
28
|
end
|
|
26
29
|
|
|
27
30
|
"(#{rendered.join(", ")})"
|
|
@@ -19,18 +19,24 @@ module YARD
|
|
|
19
19
|
[regular, examples].reject(&:empty?).join("\n\n")
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
# Formats a non-example YARD tag
|
|
22
|
+
# Formats a non-example YARD tag, including nested option details.
|
|
23
23
|
#
|
|
24
24
|
# @param tag [YARD::Tags::Tag] Non-example tag being converted into list item text.
|
|
25
25
|
# @return [String] Markdown representation of the tag.
|
|
26
26
|
def self.format_tag(tag)
|
|
27
27
|
name = tag.name.to_s
|
|
28
|
+
if tag.tag_name == "option"
|
|
29
|
+
name = "#{name}[#{tag.pair.name}]"
|
|
30
|
+
tag = tag.pair
|
|
31
|
+
defaults = tag.defaults
|
|
32
|
+
end
|
|
28
33
|
text = tag.text.to_s
|
|
29
34
|
types = Array(tag.types).map { |type| type.to_s.strip }.reject(&:empty?)
|
|
30
35
|
[
|
|
31
36
|
"**@#{tag.tag_name}**",
|
|
32
37
|
("`#{name}`" unless name.lstrip.empty?),
|
|
33
38
|
("[#{types.join(", ")}]" unless types.empty?),
|
|
39
|
+
("(default: `#{defaults.join(", ")}`)" if defaults),
|
|
34
40
|
(text.strip unless text.lstrip.empty?)
|
|
35
41
|
].compact.join(" ")
|
|
36
42
|
end
|
|
@@ -11,7 +11,10 @@ module YARD
|
|
|
11
11
|
# @param checksums [Hash, nil] Previously generated file checksums.
|
|
12
12
|
# @return [void]
|
|
13
13
|
def run_generate(checksums)
|
|
14
|
-
|
|
14
|
+
if options.format == :markdown
|
|
15
|
+
add_extra_files(markdown_files)
|
|
16
|
+
options.serializer.extension = "md"
|
|
17
|
+
end
|
|
15
18
|
|
|
16
19
|
super
|
|
17
20
|
end
|
|
@@ -19,8 +19,6 @@ def init
|
|
|
19
19
|
options.delete(:objects)
|
|
20
20
|
options.delete(:files)
|
|
21
21
|
|
|
22
|
-
options.serializer.extension = "md"
|
|
23
|
-
|
|
24
22
|
files.each { |file| options.serializer.serialize(file.filename, File.binread(file.filename)) }
|
|
25
23
|
|
|
26
24
|
objects.each do |object|
|
|
@@ -31,7 +29,7 @@ def init
|
|
|
31
29
|
log.backtrace(e)
|
|
32
30
|
end
|
|
33
31
|
|
|
34
|
-
serialize_index(
|
|
32
|
+
serialize_index(run_verifier(YARD::Registry.all(:module, :class)), files)
|
|
35
33
|
end
|
|
36
34
|
|
|
37
35
|
# Renders the markdown template for a single namespace object.
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: yard-markdown
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.10.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stanislav (Stas) Katkov
|
|
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
96
96
|
- !ruby/object:Gem::Version
|
|
97
97
|
version: '0'
|
|
98
98
|
requirements: []
|
|
99
|
-
rubygems_version: 4.0.
|
|
99
|
+
rubygems_version: 4.0.19
|
|
100
100
|
specification_version: 4
|
|
101
101
|
summary: yard plugin to generate markdown documentation
|
|
102
102
|
test_files: []
|