yard-markdown 0.5.0 → 0.7.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/example/rdoc/Bird.md CHANGED
@@ -1,16 +1,11 @@
1
- # Class: Bird
2
- **Inherits:** Object
3
-
4
-
5
- The base class for all birds.
6
-
1
+ # Class Bird <a id="class-Bird"></a>
7
2
 
3
+ **Inherits:** `Object`
8
4
 
9
- #Instance Methods
10
- ## _fly_impl(_direction, _velocity) [](#method-i-_fly_impl)
11
- :nodoc:
5
+ The base class for all birds.
12
6
 
13
- ## fly(direction, velocity) [](#method-i-fly)
7
+ ## Public Instance Methods
8
+ ### `fly(direction, velocity)` <a id="method-i-fly"></a> <a id="fly-instance_method"></a>
14
9
  Fly somewhere.
15
10
 
16
11
  Flying is the most critical feature of birds.
@@ -25,8 +20,6 @@ Flying is the most critical feature of birds.
25
20
 
26
21
  fly(:south, 70)
27
22
 
28
- ## speak() [](#method-i-speak)
23
+ ### `speak()` <a id="method-i-speak"></a> <a id="speak-instance_method"></a>
29
24
  Produce some noise. -- FIXME: maybe extract this to a base class `Animal`? ++
30
-
31
- **@yield** ["tweet"]
32
-
25
+ - **@yield** ["tweet"]
data/example/rdoc/Duck.md CHANGED
@@ -1,10 +1,8 @@
1
- # Class: Duck
2
- **Inherits:** Object
3
-
4
- **Extended by:** Animal
5
-
6
- **Includes:** Waterfowl
7
-
1
+ # Class Duck <a id="class-Duck"></a>
2
+
3
+ **Inherits:** `Object`
4
+ **Extended by:** `Animal`
5
+ **Includes:** `Waterfowl`
8
6
 
9
7
  A duck is a Waterfowl Bird.
10
8
 
@@ -19,42 +17,43 @@ Features:
19
17
 
20
18
  * swim
21
19
 
20
+ ## Constants
21
+ ### `@@rubber_ducks` <a id="classvariable--40-40rubber_ducks"></a> <a id="@@rubber_ducks-classvariable"></a>
22
+ Global list of all rubber ducks.
23
+
24
+ Use when in trouble.
22
25
 
23
- # Class Methods
24
- ## rubber_ducks() [](#method-c-rubber_ducks)
25
- **@return** [Array<Duck>] list of all rubber ducks
26
+ ### `MAX_VELOCITY` <a id="constant-MAX_VELOCITY"></a> <a id="MAX_VELOCITY-constant"></a>
27
+ Maximum velocity for a flying duck.
26
28
 
27
- # Attributes
28
- ## domestic[RW] [](#attribute-i-domestic)
29
+ ## Attributes
30
+ ### `domestic` [RW] <a id="attribute-i-domestic"></a> <a id="domestic-instance_method"></a>
29
31
  True for domestic ducks.
30
32
 
31
- ## rubber[RW] [](#attribute-i-rubber)
33
+ ### `rubber` [R] <a id="attribute-i-rubber"></a> <a id="rubber-instance_method"></a>
32
34
  True for rubber ducks.
33
35
 
36
+ ## Public Class Methods
37
+ ### `rubber_ducks()` <a id="method-c-rubber_ducks"></a> <a id="rubber_ducks-class_method"></a>
38
+ - **@return** [Array<Duck>] list of all rubber ducks
34
39
 
35
- #Instance Methods
36
- ## initialize(domestic, rubber) [](#method-i-initialize)
40
+ ## Public Instance Methods
41
+ ### `initialize(domestic, rubber)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
37
42
  Creates a new duck.
43
+ - **@param** `domestic` [Boolean]
44
+ - **@param** `rubber` [Boolean]
45
+ - **@return** [Duck] a new instance of Duck
38
46
 
39
- **@param** [Boolean]
40
-
41
- **@param** [Boolean]
42
-
43
- **@return** [Duck] a new instance of Duck
44
-
45
- ## speak() [](#method-i-speak)
47
+ ### `speak()` <a id="method-i-speak"></a> <a id="speak-instance_method"></a>
46
48
  Duck overrides generic implementation.
49
+ - **@yield** [speech]
47
50
 
48
- **@yield** [speech]
49
-
50
- ## swim() [](#method-i-swim)
51
+ ### `swim()` <a id="method-i-swim"></a> <a id="swim-instance_method"></a>
51
52
  Swimming helper.
52
53
 
53
- ## useful?() [](#method-i-useful?)
54
+ ### `useful?()` <a id="method-i-useful-3F"></a> <a id="useful?-instance_method"></a>
54
55
  Checks if this duck is a useful one.
55
56
 
56
57
  :call-seq:
57
58
  Bird.useful? -> bool
58
-
59
- **@return** [Boolean]
60
-
59
+ - **@return** [Boolean]
@@ -1,11 +1,7 @@
1
- # Module: Waterfowl
2
-
1
+ # Module Waterfowl <a id="module-Waterfowl"></a>
3
2
 
4
3
  A mixin for waterfowl creatures.
5
4
 
6
-
7
-
8
- #Instance Methods
9
- ## swim() [](#method-i-swim)
5
+ ## Public Instance Methods
6
+ ### `swim()` <a id="method-i-swim"></a> <a id="swim-instance_method"></a>
10
7
  Swimming helper.
11
-
@@ -1,21 +1,16 @@
1
1
  name,type,path
2
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
3
  Waterfowl.swim,Method,Waterfowl.md#method-i-swim
6
4
  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
5
  Bird.fly,Method,Bird.md#method-i-fly
11
6
  Bird.speak,Method,Bird.md#method-i-speak
12
7
  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
8
+ Duck.MAX_VELOCITY,Constant,Duck.md#constant-MAX_VELOCITY
9
+ Duck.@@rubber_ducks,Constant,Duck.md#classvariable--40-40rubber_ducks
15
10
  Duck.initialize,Method,Duck.md#method-i-initialize
16
11
  Duck.speak,Method,Duck.md#method-i-speak
17
12
  Duck.swim,Method,Duck.md#method-i-swim
18
- Duck.useful?,Method,Duck.md#method-i-useful?
13
+ Duck.useful?,Method,Duck.md#method-i-useful-3F
19
14
  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
15
+ Duck.domestic,Attribute,Duck.md#attribute-i-domestic
16
+ Duck.rubber,Attribute,Duck.md#attribute-i-rubber
@@ -1,13 +1,8 @@
1
- # Module: Aquatic
2
-
1
+ # Module Aquatic <a id="module-Aquatic"></a>
3
2
 
4
3
  A mixin for aquatic creatures.
5
4
 
6
-
7
-
8
- #Instance Methods
9
- ## swim() [](#method-i-swim)
5
+ ## Public Instance Methods
6
+ ### `swim()` <a id="method-i-swim"></a> <a id="swim-instance_method"></a>
10
7
  Swim in the water.
11
-
12
- **@return** [void]
13
-
8
+ - **@return** [void]
data/example/yard/Fish.md CHANGED
@@ -1,34 +1,25 @@
1
- # Class: Fish
2
- **Inherits:** Object
3
-
4
-
5
- The base class for all fish.
1
+ # Class Fish <a id="class-Fish"></a>
6
2
 
3
+ **Inherits:** `Object`
7
4
 
5
+ The base class for all fish.
8
6
 
9
- #Instance Methods
10
- ## make_sound() [](#method-i-make_sound)
7
+ ## Public Instance Methods
8
+ ### `make_sound()` <a id="method-i-make_sound"></a> <a id="make_sound-instance_method"></a>
11
9
  Make a sound.
10
+ - **@return** [void]
11
+ - **@yield** [sound] The sound produced by the fish
12
+ - **@yieldparam** `sound` [String] The actual sound
12
13
 
13
- **@return** [void]
14
-
15
- **@yield** [sound] The sound produced by the fish
16
-
17
- **@yieldparam** [String] The actual sound
18
-
19
- ## swim(direction, speed) [](#method-i-swim)
14
+ ### `swim(direction, speed)` <a id="method-i-swim"></a> <a id="swim-instance_method"></a>
20
15
  Swim in a specific direction.
21
16
 
22
17
  Swimming is the most critical feature of fish.
23
-
24
- **@param** [Symbol, String] The direction to swim
25
-
26
- **@param** [Integer] The speed at which to swim
27
-
28
- **@return** [Boolean] Whether the swim was successful
29
-
18
+ - **@param** `direction` [Symbol, String] The direction to swim
19
+ - **@param** `speed` [Integer] The speed at which to swim
20
+ - **@return** [Boolean] Whether the swim was successful
30
21
 
31
22
  **@example**
32
23
  ```ruby
33
24
  swim(:north, 30)
34
- ```
25
+ ```
@@ -1,8 +1,7 @@
1
- # Class: Salmon
2
- **Inherits:** Fish
3
-
4
- **Includes:** Aquatic
5
-
1
+ # Class Salmon <a id="class-Salmon"></a>
2
+
3
+ **Inherits:** `Fish`
4
+ **Includes:** `Aquatic`
6
5
 
7
6
  A salmon is an Aquatic Fish.
8
7
 
@@ -14,47 +13,46 @@ A salmon is an Aquatic Fish.
14
13
  * **Aquatic**
15
14
  * swim (overridden)
16
15
 
16
+ ## Constants
17
+ ### Salmon specific attributes
18
+ #### `MAX_SPEED` <a id="constant-MAX_SPEED"></a> <a id="MAX_SPEED-constant"></a>
19
+ - **@return** [Integer] Maximum speed for a swimming salmon
20
+ ### General
21
+ #### `@@wild_salmon` <a id="classvariable--40-40wild_salmon"></a> <a id="@@wild_salmon-classvariable"></a>
22
+ Global list of all wild salmon.
17
23
 
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
33
- ## initialize(farmed, wild) [](#method-i-initialize)
34
- Creates a new salmon.
24
+ Use for conservation efforts.
35
25
 
36
- **@param** [Boolean] Whether the salmon is farmed
26
+ ## Attributes
27
+ ### Salmon specific attributes
28
+ #### `farmed` [RW] <a id="attribute-i-farmed"></a> <a id="farmed-instance_method"></a>
29
+ - **@return** [Boolean] True for farmed salmon
37
30
 
38
- **@param** [Boolean] Whether the salmon is wild
31
+ #### `wild` [R] <a id="attribute-i-wild"></a> <a id="wild-instance_method"></a>
32
+ - **@return** [Boolean] True for wild salmon
39
33
 
40
- **@return** [Salmon] a new instance of Salmon
34
+ ## Public Class Methods
35
+ ### `wild_salmon()` <a id="method-c-wild_salmon"></a> <a id="wild_salmon-class_method"></a>
36
+ - **@return** [Array<Salmon>] List of all wild salmon
41
37
 
42
- ## make_sound() [](#method-i-make_sound)
38
+ ## Public Instance Methods
39
+ ### Fish overrides
40
+ #### `make_sound()` <a id="method-i-make_sound"></a> <a id="make_sound-instance_method"></a>
43
41
  Salmon overrides generic implementation.
42
+ - **@return** [void]
43
+ - **@yield** [sound] The sound produced by the salmon
44
+ - **@yieldparam** `sound` [String] The actual sound
45
+ ### General
46
+ #### `initialize(farmed, wild)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
47
+ Creates a new salmon.
48
+ - **@param** `farmed` [Boolean] Whether the salmon is farmed
49
+ - **@param** `wild` [Boolean] Whether the salmon is wild
50
+ - **@return** [Salmon] a new instance of Salmon
44
51
 
45
- **@return** [void]
46
-
47
- **@yield** [sound] The sound produced by the salmon
48
-
49
- **@yieldparam** [String] The actual sound
50
-
51
- ## sustainable?() [](#method-i-sustainable?)
52
+ #### `sustainable?()` <a id="method-i-sustainable-3F"></a> <a id="sustainable?-instance_method"></a>
52
53
  Checks if this salmon is sustainable.
54
+ - **@return** [Boolean] Whether the salmon is sustainable
53
55
 
54
- **@return** [Boolean] Whether the salmon is sustainable
55
-
56
- ## swim() [](#method-i-swim)
56
+ #### `swim()` <a id="method-i-swim"></a> <a id="swim-instance_method"></a>
57
57
  Swim in the water.
58
-
59
- **@return** [void]
60
-
58
+ - **@return** [void]
@@ -1,20 +1,16 @@
1
1
  name,type,path
2
2
  Aquatic,Module,Aquatic.md
3
- Aquatic.DEFAULT_SALMON_SPEED,Constant,Aquatic.md#constant-DEFAULT_SALMON_SPEED
4
- Aquatic.MAX_DEPTH,Constant,Aquatic.md#constant-MAX_DEPTH
5
3
  Aquatic.swim,Method,Aquatic.md#method-i-swim
6
4
  Fish,Class,Fish.md
7
- Fish.DEFAULT_SALMON_SPEED,Constant,Fish.md#constant-DEFAULT_SALMON_SPEED
8
- Fish.MAX_DEPTH,Constant,Fish.md#constant-MAX_DEPTH
9
5
  Fish.make_sound,Method,Fish.md#method-i-make_sound
10
6
  Fish.swim,Method,Fish.md#method-i-swim
11
7
  Salmon,Class,Salmon.md
12
- Salmon.DEFAULT_SALMON_SPEED,Constant,Salmon.md#constant-DEFAULT_SALMON_SPEED
13
- Salmon.MAX_DEPTH,Constant,Salmon.md#constant-MAX_DEPTH
8
+ Salmon.MAX_SPEED,Constant,Salmon.md#constant-MAX_SPEED
9
+ Salmon.@@wild_salmon,Constant,Salmon.md#classvariable--40-40wild_salmon
14
10
  Salmon.initialize,Method,Salmon.md#method-i-initialize
15
11
  Salmon.make_sound,Method,Salmon.md#method-i-make_sound
16
- Salmon.sustainable?,Method,Salmon.md#method-i-sustainable?
12
+ Salmon.sustainable?,Method,Salmon.md#method-i-sustainable-3F
17
13
  Salmon.swim,Method,Salmon.md#method-i-swim
18
14
  Salmon.wild_salmon,Method,Salmon.md#method-c-wild_salmon
19
- farmed,Attribute,Salmon.md#attribute-i-farmed
20
- wild,Attribute,Salmon.md#attribute-i-wild
15
+ Salmon.farmed,Attribute,Salmon.md#attribute-i-farmed
16
+ Salmon.wild,Attribute,Salmon.md#attribute-i-wild
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Namespace for YARD extensions used by this gem.
4
+ module YARD
5
+ # Shared helpers for rendering YARD objects as Markdown.
6
+ module Markdown
7
+ # Builds anchor-safe identifier fragments from arbitrary values.
8
+ module AnchorComponentHelper
9
+ # Encodes a value so it can be embedded safely in an HTML anchor id.
10
+ #
11
+ # @param value [Object] Raw anchor fragment to encode.
12
+ # @return [String] Anchor-safe identifier fragment.
13
+ def anchor_component(value)
14
+ value.to_s.each_char.map do |char|
15
+ char.match?(/[A-Za-z0-9_-]/) ? char : format('-%X', char.ord)
16
+ end.join
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YARD
4
+ module Markdown
5
+ # Computes anchor ids that match the generated Markdown headings.
6
+ module ArefHelper
7
+ include AnchorComponentHelper
8
+
9
+ # Returns the primary anchor id for a documented object.
10
+ #
11
+ # @param object [YARD::CodeObjects::Base] Object being rendered.
12
+ # @return [String] Anchor id for the object's heading.
13
+ def aref(object)
14
+ type = object.type
15
+
16
+ return "class-#{object.path.gsub('::', '-')}" if type == :class
17
+ return "module-#{object.path.gsub('::', '-')}" if type == :module
18
+ return "constant-#{object.name}" if type == :constant
19
+ return "classvariable-#{anchor_component(object.name)}" if type == :classvariable
20
+
21
+ scope = object.scope == :class ? 'c' : 'i'
22
+
23
+ if !object.attr_info.nil?
24
+ "attribute-#{scope}-#{object.name}"
25
+ else
26
+ "method-#{scope}-#{anchor_component(object.name)}"
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,96 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YARD
4
+ module Markdown
5
+ # Renders grouped Markdown sections for constants, attributes, and methods.
6
+ module CollectionRenderingHelper
7
+ # Renders the constants section for an object page.
8
+ #
9
+ # @param constants [Array<YARD::CodeObjects::Base>] Constant objects collected for the current page.
10
+ # @param group_order [Array<String>, nil] Preferred ordering for group headings.
11
+ # @return [String] Markdown for the constants section.
12
+ def render_constants(constants, group_order)
13
+ lines = ['## Constants']
14
+ grouped_constants = grouped_items(constants.sort_by { |item| item.name }, group_order)
15
+ uses_groups = grouped_constants.any? { |name, _items| !name.nil? }
16
+
17
+ grouped_constants.each do |group_name, items|
18
+ if uses_groups
19
+ lines << "### #{group_name || 'General'}"
20
+ item_heading = '####'
21
+ else
22
+ item_heading = '###'
23
+ end
24
+
25
+ lines << items.map { |item|
26
+ item_lines = [heading_with_anchors("#{item_heading} `#{item.name}`", item)]
27
+ append_lines(item_lines, documented_text(item), separated: false)
28
+ append_lines(item_lines, render_tags(item), separated: false)
29
+ item_lines.join("\n")
30
+ }.join("\n\n")
31
+ end
32
+
33
+ lines.join("\n")
34
+ end
35
+
36
+ # Renders the attributes section for an object page.
37
+ #
38
+ # @param attrs [Array<YARD::CodeObjects::MethodObject>] Attributes to render.
39
+ # @param group_order [Array<String>, nil] Preferred ordering for group headings.
40
+ # @return [String] Markdown for the attributes section.
41
+ def render_attributes(attrs, group_order)
42
+ lines = ['## Attributes']
43
+ grouped_attrs = grouped_items(attrs, group_order)
44
+ uses_groups = grouped_attrs.any? { |name, _items| !name.nil? }
45
+
46
+ grouped_attrs.each do |group_name, items|
47
+ if uses_groups
48
+ lines << "### #{group_name || 'General'}"
49
+ item_heading = '####'
50
+ else
51
+ item_heading = '###'
52
+ end
53
+
54
+ lines << items.map { |item|
55
+ item_lines = [heading_with_anchors("#{item_heading} `#{item.name}` [#{attribute_access(item)}]", item)]
56
+ append_lines(item_lines, documented_text(item), separated: false)
57
+ append_lines(item_lines, render_tags(item), separated: false)
58
+ item_lines.join("\n")
59
+ }.join("\n\n")
60
+ end
61
+
62
+ lines.join("\n")
63
+ end
64
+
65
+ # Renders a method section for an object page.
66
+ #
67
+ # @param section_title [String] Section title to render.
68
+ # @param methods [Array<YARD::CodeObjects::MethodObject>] Method objects collected for the current section.
69
+ # @param group_order [Array<String>, nil] Preferred ordering for group headings.
70
+ # @return [String] Markdown for the method section.
71
+ def render_methods(section_title, methods, group_order)
72
+ lines = ["## #{section_title}"]
73
+ grouped_methods = grouped_items(methods, group_order)
74
+ uses_groups = grouped_methods.any? { |name, _items| !name.nil? }
75
+
76
+ grouped_methods.each do |group_name, items|
77
+ if uses_groups
78
+ lines << "### #{group_name || 'General'}"
79
+ item_heading = '####'
80
+ else
81
+ item_heading = '###'
82
+ end
83
+
84
+ lines << items.map { |item|
85
+ item_lines = [heading_with_anchors("#{item_heading} `#{formatted_method_heading(item)}`", item)]
86
+ append_lines(item_lines, documented_text(item), separated: false)
87
+ append_lines(item_lines, render_tags(item), separated: false)
88
+ item_lines.join("\n")
89
+ }.join("\n\n")
90
+ end
91
+
92
+ lines.join("\n")
93
+ end
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rdoc'
4
+
5
+ module YARD
6
+ module Markdown
7
+ # Converts YARD docstrings into Markdown-friendly text.
8
+ module DocumentationHelper
9
+ # Returns the rendered documentation text for an object.
10
+ #
11
+ # @param object [YARD::CodeObjects::Base] Object whose docstring is being rendered.
12
+ # @return [String] Converted documentation text or a fallback message.
13
+ def documented_text(object)
14
+ text = rdoc_to_md(object.docstring)
15
+ return text unless text.empty?
16
+ return '' unless object.tags.empty?
17
+
18
+ 'Not documented.'
19
+ end
20
+
21
+ # Converts an RDoc-formatted docstring to Markdown.
22
+ #
23
+ # @param docstring [Object] Raw docstring content.
24
+ # @return [String] Markdown-rendered docstring content.
25
+ def rdoc_to_md(docstring)
26
+ RDoc::Markup::ToMarkdown.new.convert(docstring).rstrip
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YARD
4
+ module Markdown
5
+ # Builds headings and legacy anchors for rendered object sections.
6
+ module HeadingHelper
7
+ include ArefHelper
8
+
9
+ # Returns the legacy YARD anchor for an object when one exists.
10
+ #
11
+ # @param object [YARD::CodeObjects::Base] Object being rendered.
12
+ # @return [String, nil] Legacy anchor id, if supported.
13
+ def legacy_aref(object)
14
+ type = object.type
15
+
16
+ return "#{object.name}-constant" if type == :constant
17
+ return "#{object.name}-classvariable" if type == :classvariable
18
+ return nil unless object.respond_to?(:scope)
19
+
20
+ return "#{object.name}-class_method" if object.scope == :class
21
+
22
+ "#{object.name}-instance_method"
23
+ end
24
+
25
+ # Returns all anchor tags that should be attached to a heading.
26
+ #
27
+ # @param object [YARD::CodeObjects::Base] Object being rendered.
28
+ # @return [Array<String>] HTML anchor tags for the object.
29
+ def anchor_tags_for(object)
30
+ anchors = [aref(object), legacy_aref(object)].compact
31
+ anchors.map { |id| anchor_tag(id) }
32
+ end
33
+
34
+ # Appends the generated anchor tags to a Markdown heading.
35
+ #
36
+ # @param heading [String] Heading text to decorate.
37
+ # @param object [YARD::CodeObjects::Base] Object being rendered.
38
+ # @return [String] Heading text with embedded anchor tags.
39
+ def heading_with_anchors(heading, object)
40
+ "#{heading} #{anchor_tags_for(object).join(' ')}"
41
+ end
42
+
43
+ # Builds an HTML anchor tag for a generated id.
44
+ #
45
+ # @param id [String] Anchor id value.
46
+ # @return [String] HTML anchor tag.
47
+ def anchor_tag(id)
48
+ %(<a id="#{id}"></a>)
49
+ end
50
+ end
51
+ end
52
+ end