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.
@@ -0,0 +1,125 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pathname'
4
+ require 'rdoc'
5
+
6
+ include Helpers::ModuleHelper
7
+ include YARD::Markdown::AnchorComponentHelper
8
+ include YARD::Markdown::ArefHelper
9
+ include YARD::Markdown::CollectionRenderingHelper
10
+ include YARD::Markdown::DocumentationHelper
11
+ include YARD::Markdown::HeadingHelper
12
+ include YARD::Markdown::LinkNormalizationHelper
13
+ include YARD::Markdown::MethodPresentationHelper
14
+ include YARD::Markdown::ObjectListingHelper
15
+ include YARD::Markdown::RelationshipSectionHelper
16
+ include YARD::Markdown::SectionAssemblyHelper
17
+ include YARD::Markdown::TagFormattingHelper
18
+
19
+ # Registers the sections rendered for a namespace markdown page.
20
+ #
21
+ # @return [void]
22
+ def init
23
+ sections :header,
24
+ :relationships,
25
+ :docstring_section,
26
+ :tags_section,
27
+ :constants_section,
28
+ :attributes_section,
29
+ :public_class_methods_section,
30
+ :public_instance_methods_section
31
+ end
32
+
33
+ # Renders the template and normalizes markdown for top-level page output.
34
+ #
35
+ # @param opts [Hash, nil] Template options passed through to the base template.
36
+ # @option opts [YARD::CodeObjects::NamespaceObject] :object Object being rendered.
37
+ # @param sects [Array<Symbol>] Section names to render.
38
+ # @param start_at [Integer] Starting index within `sects`.
39
+ # @param break_first [Boolean] Whether rendering stops after the first section.
40
+ # @yield Optional block forwarded to the base template renderer.
41
+ # @return [String] Rendered markdown output.
42
+ def run(opts = nil, sects = sections, start_at = 0, break_first = false, &block)
43
+ output = super
44
+ return output unless top_level_render?(sects, start_at, break_first)
45
+
46
+ finalize_markdown(output, options.serializer.serialized_path(object))
47
+ end
48
+
49
+ # Returns whether this invocation is rendering the full top-level page.
50
+ #
51
+ # @param sects [Array<Symbol>] Section names requested for rendering.
52
+ # @param start_at [Integer] Starting index within `sects`.
53
+ # @param break_first [Boolean] Whether rendering stops after the first section.
54
+ # @return [Boolean] True when the whole page is being rendered in one pass.
55
+ def top_level_render?(sects, start_at, break_first)
56
+ !break_first && start_at.zero? && sects == sections
57
+ end
58
+
59
+ # Renders the page heading for the current object.
60
+ #
61
+ # @return [String] Markdown heading section.
62
+ def header
63
+ render_section_content(heading_with_anchors("# #{object.type.to_s.capitalize} #{object.path}", object))
64
+ end
65
+
66
+ # Renders inheritance and mixin relationships for the current object.
67
+ #
68
+ # @return [String] Markdown relationships section.
69
+ def relationships
70
+ render_section_content(object_relationships(object))
71
+ end
72
+
73
+ # Renders the object's docstring as markdown.
74
+ #
75
+ # @return [String] Markdown docstring section.
76
+ def docstring_section
77
+ render_section_content(rdoc_to_md(object.docstring))
78
+ end
79
+
80
+ # Renders the object's YARD tags.
81
+ #
82
+ # @return [String] Markdown tags section.
83
+ def tags_section
84
+ render_section_content(render_tags(object))
85
+ end
86
+
87
+ # Renders the constants section when visible constants are present.
88
+ #
89
+ # @return [String] Markdown constants section, or an empty string.
90
+ def constants_section
91
+ constants = constant_listing(object).reject { |item| hidden_object?(item) }
92
+ return '' unless constants.any?
93
+
94
+ render_section_content(render_constants(constants, Array(object.groups)))
95
+ end
96
+
97
+ # Renders the attributes section when visible attributes are present.
98
+ #
99
+ # @return [String] Markdown attributes section, or an empty string.
100
+ def attributes_section
101
+ attrs = attr_listing(object).reject { |item| hidden_object?(item) }
102
+ return '' unless attrs.any?
103
+
104
+ render_section_content(render_attributes(attrs, Array(object.groups)))
105
+ end
106
+
107
+ # Renders the public class methods section when methods are present.
108
+ #
109
+ # @return [String] Markdown public class methods section, or an empty string.
110
+ def public_class_methods_section
111
+ methods = public_class_methods(object)
112
+ return '' unless methods.any?
113
+
114
+ render_section_content(render_methods('Public Class Methods', methods, Array(object.groups)))
115
+ end
116
+
117
+ # Renders the public instance methods section when methods are present.
118
+ #
119
+ # @return [String] Markdown public instance methods section, or an empty string.
120
+ def public_instance_methods_section
121
+ methods = public_instance_methods(object)
122
+ return '' unless methods.any?
123
+
124
+ render_section_content(render_methods('Public Instance Methods', methods, Array(object.groups)))
125
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yard-markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stanislav (Stas) Katkov
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2024-12-28 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: yard
@@ -37,6 +37,20 @@ dependencies:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: rdoc
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
40
54
  description: yard plugin to generate markdown documentation for gems
41
55
  email:
42
56
  - yard-markdown@skatkov.com
@@ -46,10 +60,14 @@ extra_rdoc_files: []
46
60
  files:
47
61
  - ".editorconfig"
48
62
  - ".streerc"
63
+ - ".yard-lint.yml"
49
64
  - ".yardopts"
65
+ - AGENTS.md
66
+ - CHANGELOG.md
50
67
  - LICENSE.txt
51
68
  - README.md
52
69
  - Rakefile
70
+ - config/mutant.yml
53
71
  - example/rdoc/Bird.md
54
72
  - example/rdoc/Duck.md
55
73
  - example/rdoc/Waterfowl.md
@@ -61,8 +79,20 @@ files:
61
79
  - example_rdoc.rb
62
80
  - example_yard.rb
63
81
  - lib/yard-markdown.rb
82
+ - lib/yard/markdown/anchor_component_helper.rb
83
+ - lib/yard/markdown/aref_helper.rb
84
+ - lib/yard/markdown/collection_rendering_helper.rb
85
+ - lib/yard/markdown/documentation_helper.rb
86
+ - lib/yard/markdown/heading_helper.rb
87
+ - lib/yard/markdown/link_normalization_helper.rb
88
+ - lib/yard/markdown/method_presentation_helper.rb
89
+ - lib/yard/markdown/object_listing_helper.rb
90
+ - lib/yard/markdown/relationship_section_helper.rb
91
+ - lib/yard/markdown/section_assembly_helper.rb
92
+ - lib/yard/markdown/tag_formatting_helper.rb
64
93
  - sig/yard/markdown.rbs
65
94
  - templates/default/fulldoc/markdown/setup.rb
95
+ - templates/default/module/markdown/setup.rb
66
96
  homepage: https://poshtui.com
67
97
  licenses:
68
98
  - MIT
@@ -83,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
113
  - !ruby/object:Gem::Version
84
114
  version: '0'
85
115
  requirements: []
86
- rubygems_version: 3.6.2
116
+ rubygems_version: 4.0.10
87
117
  specification_version: 4
88
118
  summary: yard plugin to generate markdown documentation
89
119
  test_files: []