rdoc-markdown 0.10.3 → 0.11.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: f0eae6267dc89dd3b398c7498a2cc7d9458feb1b177a66dbd5dcdd20d1c421e4
4
- data.tar.gz: 8dff34ad7b48a1bd9b0a06a8b395490427888427425dc24e4551eee48a75028d
3
+ metadata.gz: 405929506a512e2000ebf5446b834abc96b1d5547fc3d6ec09daecf28356f4d5
4
+ data.tar.gz: b3d82d2787e012d16d9ca72d72fa2617e096315ea11eb80db0874fd609cb938b
5
5
  SHA512:
6
- metadata.gz: bee22d3e444a8bbc5bf4fc0d0e5f6f9c269b8dd5ae70c9e00a91b9b41dad23490b51b56bfe3af6d7dcbc20e0d0e73e2afd2bf1a224598da29610ba08f713eec5
7
- data.tar.gz: 7836c11cd909c34211aac0a0e4908e7d25143bc9ccf4296a973f0ddadf4c1b205658ce1e6fffb76f48f227193ffb811cd41e4ad7ab273438ff54eda8263af0a8
6
+ metadata.gz: acf30a9851cbb932c3a51a05541b296cb0d2f5c5b910b40812824c43c69ee9e423312c3b07ccceff901b0cea2889bc5f2f8373bd0a79f40985d232183185d5e5
7
+ data.tar.gz: 6d994d364f33251761a52f58e69dc534cd4806c2eea806e9d536f65b681a92b4d0b1e096436012c3d0aad6dac07bcad379620ce7a94b09ebd2c28e43bf9349d6
data/.yard-lint.yml CHANGED
@@ -13,7 +13,7 @@ AllValidators:
13
13
  - "spec/**/*"
14
14
  - "test/**/*"
15
15
  - "tmp/**/*"
16
- - lib/rdoc/markdown/version.rb
16
+ - "lib/rdoc/markdown/version.rb"
17
17
 
18
18
  FailOnSeverity: error
19
19
  MinCoverage: 100.0
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.11.0
6
+
7
+ ### Changed
8
+ - properly convert code block to markdown with language definition
9
+
10
+ ### Fixed
11
+ - Put generated anchors before heading lines so terminal markdown renderers parse headings correctly.
12
+
5
13
  ## 0.10.3
6
14
  - Remove extra spacing between title 3 and content
7
15
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rdoc-markdown (0.10.3)
4
+ rdoc-markdown (0.11.0)
5
5
  csv
6
6
  erb
7
7
  rdoc
data/example/Bird.md CHANGED
@@ -1,13 +1,11 @@
1
- # Class Bird
2
1
  <a id="class-bird"></a>
3
-
2
+ # Class Bird
4
3
  The base class for all birds.
5
4
 
6
5
  ### Public Instance Methods
7
6
 
8
- #### `fly(direction: string, velocity: number) -> bool`
9
7
  <a id="method-i-fly"></a>
10
-
8
+ #### `fly(direction: string, velocity: number) -> bool`
11
9
  Fly somewhere.
12
10
 
13
11
  Flying is the most critical feature of birds.
@@ -18,7 +16,6 @@ Flying is the most critical feature of birds.
18
16
  fly(:south, 70)
19
17
  ```
20
18
 
21
- #### `speak() { |text| ... }`
22
19
  <a id="method-i-speak"></a>
23
-
20
+ #### `speak() { |text| ... }`
24
21
  Produce some noise.
data/example/Duck.md CHANGED
@@ -1,6 +1,5 @@
1
- # Class Duck
2
1
  <a id="class-duck"></a>
3
-
2
+ # Class Duck
4
3
  A duck is a [`Waterfowl`](Waterfowl.md) [`Bird`](Bird.md).
5
4
 
6
5
  Features:
@@ -18,47 +17,40 @@ waterfowl:
18
17
 
19
18
  ### Public Instance Methods
20
19
 
21
- #### `speak() { |speech| ... }`
22
20
  <a id="method-i-speak"></a>
23
-
21
+ #### `speak() { |speech| ... }`
24
22
  [`Duck`](Duck.md) overrides generic implementation.
25
23
 
26
24
  ## Duck extensions
27
25
 
28
26
  ### Constants
29
27
 
30
- #### `MAX_VELOCITY`
31
28
  <a id="MAX_VELOCITY"></a>
32
-
29
+ #### `MAX_VELOCITY`
33
30
  Not documented.
34
31
 
35
32
  ### Attributes
36
33
 
37
- #### `domestic` [RW]
38
34
  <a id="attribute-i-domestic"></a>
39
-
35
+ #### `domestic` [RW]
40
36
  True for domestic ducks.
41
37
 
42
- #### `rubber` [R]
43
38
  <a id="attribute-i-rubber"></a>
44
-
39
+ #### `rubber` [R]
45
40
  True for rubber ducks.
46
41
 
47
42
  ### Public Class Methods
48
43
 
49
- #### `new(domestic, rubber)`
50
44
  <a id="method-c-new"></a>
51
-
45
+ #### `new(domestic, rubber)`
52
46
  Creates a new duck.
53
47
 
54
- #### `rubber_ducks()`
55
48
  <a id="method-c-rubber_ducks"></a>
56
-
49
+ #### `rubber_ducks()`
57
50
  Returns list of all rubber ducks.
58
51
 
59
52
  ### Public Instance Methods
60
53
 
61
- #### `useful? -> bool`
62
54
  <a id="method-i-useful-3F"></a>
63
-
55
+ #### `useful? -> bool`
64
56
  Checks if this duck is a useful one.
data/example/Object.md CHANGED
@@ -1,9 +1,8 @@
1
- # Class Object
2
1
  <a id="class-object"></a>
2
+ # Class Object
3
3
 
4
4
  ### Constants
5
5
 
6
- #### `DEFAULT_DUCK_VELOCITY`
7
6
  <a id="DEFAULT_DUCK_VELOCITY"></a>
8
-
7
+ #### `DEFAULT_DUCK_VELOCITY`
9
8
  Default velocity for a flying duck.
data/example/Waterfowl.md CHANGED
@@ -1,11 +1,9 @@
1
- # Module Waterfowl
2
1
  <a id="module-waterfowl"></a>
3
-
2
+ # Module Waterfowl
4
3
  A mixin for waterfowl creatures.
5
4
 
6
5
  ### Public Instance Methods
7
6
 
8
- #### `swim()`
9
7
  <a id="method-i-swim"></a>
10
-
8
+ #### `swim()`
11
9
  Swimming helper.
@@ -1,6 +1,5 @@
1
- # Class Jekyll::SeoTag::AuthorDrop
2
1
  <a id="class-jekyll-seotag-authordrop"></a>
3
-
2
+ # Class Jekyll::SeoTag::AuthorDrop
4
3
  A drop representing the current page’s author
5
4
 
6
5
  Author name will be pulled from:
@@ -15,26 +14,22 @@ If the result from the name search is a string, we’ll also check for additiona
15
14
 
16
15
  ### Public Class Methods
17
16
 
18
- #### `new(page: nil, site: nil)`
19
17
  <a id="method-c-new"></a>
20
-
18
+ #### `new(page: nil, site: nil)`
21
19
  Initialize a new [`AuthorDrop`](AuthorDrop.md)
22
20
 
23
21
  page - The page hash (e.g., Page#to\_liquid) site - The Jekyll::Drops::SiteDrop
24
22
 
25
23
  ### Public Instance Methods
26
24
 
27
- #### `name()`
28
25
  <a id="method-i-name"></a>
29
-
26
+ #### `name()`
30
27
  [`AuthorDrop#to_s`](AuthorDrop.md#method-i-to_s) should return name, allowing the author drop to safely replace `page.author`, if necessary, and remain backwards compatible
31
28
 
32
- #### `to_s()`
33
29
  <a id="method-i-to_s"></a>
34
-
30
+ #### `to_s()`
35
31
  Alias for: [`name`](#method-i-name)
36
32
 
37
- #### `twitter()`
38
33
  <a id="method-i-twitter"></a>
39
-
34
+ #### `twitter()`
40
35
  Not documented.
@@ -1,133 +1,108 @@
1
- # Class Jekyll::SeoTag::Drop
2
1
  <a id="class-jekyll-seotag-drop"></a>
2
+ # Class Jekyll::SeoTag::Drop
3
3
 
4
4
  ### Constants
5
5
 
6
- #### `FORMAT_STRING_METHODS`
7
6
  <a id="FORMAT_STRING_METHODS"></a>
8
-
7
+ #### `FORMAT_STRING_METHODS`
9
8
  Not documented.
10
9
 
11
- #### `HOMEPAGE_OR_ABOUT_REGEX`
12
10
  <a id="HOMEPAGE_OR_ABOUT_REGEX"></a>
13
-
11
+ #### `HOMEPAGE_OR_ABOUT_REGEX`
14
12
  Not documented.
15
13
 
16
- #### `TITLE_SEPARATOR`
17
14
  <a id="TITLE_SEPARATOR"></a>
18
-
15
+ #### `TITLE_SEPARATOR`
19
16
  Not documented.
20
17
 
21
18
  ### Public Class Methods
22
19
 
23
- #### `new(text, context)`
24
20
  <a id="method-c-new"></a>
25
-
21
+ #### `new(text, context)`
26
22
  Not documented.
27
23
 
28
24
  ### Public Instance Methods
29
25
 
30
- #### `author()`
31
26
  <a id="method-i-author"></a>
32
-
27
+ #### `author()`
33
28
  A drop representing the page author
34
29
 
35
- #### `canonical_url()`
36
30
  <a id="method-i-canonical_url"></a>
37
-
31
+ #### `canonical_url()`
38
32
  Not documented.
39
33
 
40
- #### `date_modified()`
41
34
  <a id="method-i-date_modified"></a>
42
-
35
+ #### `date_modified()`
43
36
  Not documented.
44
37
 
45
- #### `date_published()`
46
38
  <a id="method-i-date_published"></a>
47
-
39
+ #### `date_published()`
48
40
  Not documented.
49
41
 
50
- #### `description()`
51
42
  <a id="method-i-description"></a>
52
-
43
+ #### `description()`
53
44
  Not documented.
54
45
 
55
- #### `image()`
56
46
  <a id="method-i-image"></a>
57
-
47
+ #### `image()`
58
48
  Returns a [`Drop`](Drop.md) representing the page’s image Returns nil if the image has no path, to preserve backwards compatability
59
49
 
60
- #### `json_ld()`
61
50
  <a id="method-i-json_ld"></a>
62
-
51
+ #### `json_ld()`
63
52
  A drop representing the JSON-LD output
64
53
 
65
- #### `links()`
66
54
  <a id="method-i-links"></a>
67
-
55
+ #### `links()`
68
56
  Not documented.
69
57
 
70
- #### `logo()`
71
58
  <a id="method-i-logo"></a>
72
-
59
+ #### `logo()`
73
60
  Not documented.
74
61
 
75
- #### `name()`
76
62
  <a id="method-i-name"></a>
77
-
63
+ #### `name()`
78
64
  rubocop:enable Metrics/CyclomaticComplexity
79
65
 
80
- #### `page_lang()`
81
66
  <a id="method-i-page_lang"></a>
82
-
67
+ #### `page_lang()`
83
68
  Not documented.
84
69
 
85
- #### `page_locale()`
86
70
  <a id="method-i-page_locale"></a>
87
-
71
+ #### `page_locale()`
88
72
  Not documented.
89
73
 
90
- #### `page_title()`
91
74
  <a id="method-i-page_title"></a>
92
-
75
+ #### `page_title()`
93
76
  Page title without site title or description appended
94
77
 
95
- #### `site_description()`
96
78
  <a id="method-i-site_description"></a>
97
-
79
+ #### `site_description()`
98
80
  Not documented.
99
81
 
100
- #### `site_tagline()`
101
82
  <a id="method-i-site_tagline"></a>
102
-
83
+ #### `site_tagline()`
103
84
  Not documented.
104
85
 
105
- #### `site_tagline_or_description()`
106
86
  <a id="method-i-site_tagline_or_description"></a>
107
-
87
+ #### `site_tagline_or_description()`
108
88
  Not documented.
109
89
 
110
- #### `site_title()`
111
90
  <a id="method-i-site_title"></a>
112
-
91
+ #### `site_title()`
113
92
  Not documented.
114
93
 
115
- #### `title()`
116
94
  <a id="method-i-title"></a>
117
-
95
+ #### `title()`
118
96
  Page title with site title or description appended rubocop:disable Metrics/CyclomaticComplexity
119
97
 
120
- #### `title?()`
121
98
  <a id="method-i-title-3F"></a>
122
-
99
+ #### `title?()`
123
100
  Should the ‘\<title\>` tag be generated for this page?
124
101
 
125
- #### `type()`
126
102
  <a id="method-i-type"></a>
127
-
103
+ #### `type()`
128
104
  Not documented.
129
105
 
130
- #### `version()`
131
106
  <a id="method-i-version"></a>
132
-
107
+ #### `version()`
133
108
  Not documented.
@@ -1,9 +1,8 @@
1
- # Class Jekyll::SeoTag::Filters
2
1
  <a id="class-jekyll-seotag-filters"></a>
2
+ # Class Jekyll::SeoTag::Filters
3
3
 
4
4
  ### Public Class Methods
5
5
 
6
- #### `new(context)`
7
6
  <a id="method-c-new"></a>
8
-
7
+ #### `new(context)`
9
8
  Not documented.
@@ -1,6 +1,5 @@
1
- # Class Jekyll::SeoTag::ImageDrop
2
1
  <a id="class-jekyll-seotag-imagedrop"></a>
3
-
2
+ # Class Jekyll::SeoTag::ImageDrop
4
3
  A drop representing the page image The image path will be pulled from:
5
4
 
6
5
  1. The `image` key if it’s a string
@@ -13,21 +12,18 @@ A drop representing the page image The image path will be pulled from:
13
12
 
14
13
  ### Public Class Methods
15
14
 
16
- #### `new(page: nil, context: nil)`
17
15
  <a id="method-c-new"></a>
18
-
16
+ #### `new(page: nil, context: nil)`
19
17
  Initialize a new [`ImageDrop`](ImageDrop.md)
20
18
 
21
19
  page - The page hash (e.g., Page#to\_liquid) context - the Liquid::Context
22
20
 
23
21
  ### Public Instance Methods
24
22
 
25
- #### `path()`
26
23
  <a id="method-i-path"></a>
27
-
24
+ #### `path()`
28
25
  Called path for backwards compatability, this is really the escaped, absolute URL representing the page’s image Returns nil if no image path can be determined
29
26
 
30
- #### `to_s()`
31
27
  <a id="method-i-to_s"></a>
32
-
28
+ #### `to_s()`
33
29
  Alias for: [`path`](#method-i-path)
@@ -1,18 +1,15 @@
1
- # Module Jekyll::SeoTag::JSONLD
2
1
  <a id="module-jekyll-seotag-jsonld"></a>
3
-
2
+ # Module Jekyll::SeoTag::JSONLD
4
3
  This module is deprecated, but is included in the Gem to avoid a breaking change and should be removed at the next major version bump
5
4
 
6
5
  ### Constants
7
6
 
8
- #### `METHODS_KEYS`
9
7
  <a id="METHODS_KEYS"></a>
10
-
8
+ #### `METHODS_KEYS`
11
9
  Not documented.
12
10
 
13
11
  ### Public Instance Methods
14
12
 
15
- #### `json_ld()`
16
13
  <a id="method-i-json_ld"></a>
17
-
14
+ #### `json_ld()`
18
15
  Self should be a [`Jekyll::SeoTag::Drop`](Drop.md) instance (when extending the module)
@@ -1,41 +1,34 @@
1
- # Class Jekyll::SeoTag::JSONLDDrop
2
1
  <a id="class-jekyll-seotag-jsonlddrop"></a>
2
+ # Class Jekyll::SeoTag::JSONLDDrop
3
3
 
4
4
  ### Public Class Methods
5
5
 
6
- #### `new(page_drop)`
7
6
  <a id="method-c-new"></a>
8
-
7
+ #### `new(page_drop)`
9
8
  page\_drop should be an instance of [`Jekyll::SeoTag::Drop`](Drop.md)
10
9
 
11
10
  ### Public Instance Methods
12
11
 
13
- #### `author()`
14
12
  <a id="method-i-author"></a>
15
-
13
+ #### `author()`
16
14
  Not documented.
17
15
 
18
- #### `fallback_data()`
19
16
  <a id="method-i-fallback_data"></a>
20
-
17
+ #### `fallback_data()`
21
18
  Not documented.
22
19
 
23
- #### `image()`
24
20
  <a id="method-i-image"></a>
25
-
21
+ #### `image()`
26
22
  Not documented.
27
23
 
28
- #### `mainEntityOfPage()`
29
24
  <a id="method-i-mainEntityOfPage"></a>
30
-
25
+ #### `mainEntityOfPage()`
31
26
  Alias for: [`main_entity`](#method-i-main_entity)
32
27
 
33
- #### `publisher()`
34
28
  <a id="method-i-publisher"></a>
35
-
29
+ #### `publisher()`
36
30
  Not documented.
37
31
 
38
- #### `to_json(state = nil)`
39
32
  <a id="method-i-to_json"></a>
40
-
33
+ #### `to_json(state = nil)`
41
34
  Returns a JSON-encoded object containing the JSON-LD data. Keys are sorted.
@@ -1,5 +1,4 @@
1
- # Module Jekyll::SeoTag::UrlHelper
2
1
  <a id="module-jekyll-seotag-urlhelper"></a>
3
-
2
+ # Module Jekyll::SeoTag::UrlHelper
4
3
  Mixin to share common URL-related methods between class
5
4
 
@@ -1,11 +1,10 @@
1
- # Class Jekyll::SeoTag
2
1
  <a id="class-jekyll-seotag"></a>
2
+ # Class Jekyll::SeoTag
3
3
 
4
4
  ### Constants
5
5
 
6
- #### `MINIFY_REGEX`
7
6
  <a id="MINIFY_REGEX"></a>
8
-
7
+ #### `MINIFY_REGEX`
9
8
  Matches all whitespace that follows either
10
9
 
11
10
  ```
@@ -22,33 +21,28 @@ so that we do not interfere with the HTML comment at the
22
21
  very begining
23
22
  ```
24
23
 
25
- #### `VERSION`
26
24
  <a id="VERSION"></a>
27
-
25
+ #### `VERSION`
28
26
  Not documented.
29
27
 
30
28
  ### Attributes
31
29
 
32
- #### `context` [RW]
33
30
  <a id="attribute-i-context"></a>
34
-
31
+ #### `context` [RW]
35
32
  Not documented.
36
33
 
37
34
  ### Public Class Methods
38
35
 
39
- #### `new(_tag_name, text, _tokens)`
40
36
  <a id="method-c-new"></a>
41
-
37
+ #### `new(_tag_name, text, _tokens)`
42
38
  Not documented.
43
39
 
44
- #### `template()`
45
40
  <a id="method-c-template"></a>
46
-
41
+ #### `template()`
47
42
  Not documented.
48
43
 
49
44
  ### Public Instance Methods
50
45
 
51
- #### `render(context)`
52
46
  <a id="method-i-render"></a>
53
-
47
+ #### `render(context)`
54
48
  Not documented.
@@ -1,3 +1,3 @@
1
- # Module Jekyll
2
1
  <a id="module-jekyll"></a>
2
+ # Module Jekyll
3
3
 
@@ -1,3 +1,3 @@
1
- # Class Liquid::Tag
2
1
  <a id="class-liquid-tag"></a>
2
+ # Class Liquid::Tag
3
3
 
@@ -1,5 +1,4 @@
1
- # Module Liquid
2
1
  <a id="module-liquid"></a>
3
-
2
+ # Module Liquid
4
3
  Prevent bundler errors
5
4
 
@@ -148,7 +148,11 @@ class RDoc::Generator::Markdown::RbsSignatureIndex
148
148
  Array(lines).select { |line| line&.match?(/\S/) }
149
149
  end
150
150
 
151
+ # Creates an immutable signature index.
152
+ #
151
153
  # @param signatures [Hash{Array => Array<String>}] Signature lookup.
154
+ #
155
+ # @return [void]
152
156
  def initialize(signatures)
153
157
  @signatures = signatures
154
158
  end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Preserves simple <pre class="ruby"> language metadata emitted by RDoc.
4
+ class ReverseMarkdown::Converters::RDocMarkdownPre < ReverseMarkdown::Converters::Pre
5
+ # Matches RDoc's plain language class names on pre blocks.
6
+ LANGUAGE_CLASS = /\A(?!highlight\z)[A-Za-z][A-Za-z0-9_+-]*\z/
7
+
8
+ # Converts an RDoc pre block into a GitHub-flavored Markdown fence.
9
+ #
10
+ # @param node [Nokogiri::XML::Node] RDoc pre node.
11
+ # @param _state [Hash] reverse_markdown converter state.
12
+ #
13
+ # @return [String] Markdown code fence.
14
+ def convert(node, _state)
15
+ content = treat_children(rdoc_pre_node(node), {})
16
+ "\n```#{language(node)}\n" << content << "\n```\n"
17
+ end
18
+
19
+ private
20
+
21
+ # Rebuilds a plain pre node from RDoc-highlighted text.
22
+ #
23
+ # @param node [Nokogiri::XML::Node] RDoc pre node.
24
+ #
25
+ # @return [Nokogiri::XML::Node] Plain pre node.
26
+ def rdoc_pre_node(node)
27
+ Nokogiri::HTML.fragment("<pre>#{node.text}</pre>").at("pre")
28
+ end
29
+
30
+ # Extracts the Markdown fence language.
31
+ #
32
+ # @param node [Nokogiri::XML::Node] RDoc pre node.
33
+ #
34
+ # @return [String, nil] Language name, or nil when no language is known.
35
+ def language(node)
36
+ node["class"].to_s[LANGUAGE_CLASS] || super
37
+ end
38
+ end
39
+
40
+ ReverseMarkdown::Converters.register :pre, ReverseMarkdown::Converters::RDocMarkdownPre.new
@@ -5,8 +5,8 @@ gem "rdoc"
5
5
  require "erb"
6
6
  require "reverse_markdown"
7
7
  require "csv"
8
- require "cgi"
9
8
  require "optparse"
9
+ require_relative "markdown/rdoc_markdown_pre"
10
10
 
11
11
  # Generates Markdown output and a CSV search index from an RDoc store.
12
12
  class RDoc::Generator::Markdown
@@ -315,9 +315,7 @@ class RDoc::Generator::Markdown
315
315
  # - bypass - Ignore the unknown tag but try to convert its content
316
316
  # - raise - Raise an error to let you know
317
317
 
318
- html = normalize_rdoc_pre_blocks(input)
319
-
320
- md = ReverseMarkdown.convert(html, github_flavored: true, unknown_tags: @markdown_unknown_tags).dup
318
+ md = ReverseMarkdown.convert(input, github_flavored: true, unknown_tags: @markdown_unknown_tags).dup
321
319
 
322
320
  # Flatten headings whose visible text is wrapped in a self-link.
323
321
  md.gsub!(/^(#+)\s\[([^\]]+)\]\((?:#[^)]+)\)$/) { "#{Regexp.last_match(1)} #{Regexp.last_match(2)}" }
@@ -574,7 +572,7 @@ class RDoc::Generator::Markdown
574
572
  #
575
573
  # @return [String] Markdown with convertible blocks normalized.
576
574
  def normalize_definition_list_code_blocks(markdown)
577
- markdown.gsub(/```\n(.+?)\n```/m) do
575
+ markdown.gsub(/```[^\n]*\n(.+?)\n```/m) do
578
576
  body = Regexp.last_match(1)
579
577
  converted = convert_definition_list_block(body)
580
578
  converted.nil? ? Regexp.last_match : converted
@@ -622,19 +620,6 @@ class RDoc::Generator::Markdown
622
620
  "#{output_path_for(target_parent)}##{method.aref}"
623
621
  end
624
622
 
625
- # Removes RDoc's generated HTML tags from verbatim pre blocks.
626
- #
627
- # @param html [String] RDoc HTML fragment.
628
- #
629
- # @return [String] HTML fragment with normalized pre blocks.
630
- def normalize_rdoc_pre_blocks(html)
631
- html.gsub(%r{<pre\b[^>]*>(?:.+?)</pre>}m) do
632
- raw = Regexp.last_match(0)
633
- text = raw.gsub(/<[^>]+>/, "")
634
- "<pre>#{CGI.unescapeHTML(text)}</pre>"
635
- end
636
- end
637
-
638
623
  # Rewrites local Markdown links relative to the current output file.
639
624
  #
640
625
  # @param markdown [String] Markdown content.
@@ -1,7 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # @private
3
4
  module Rdoc
5
+ # @private
4
6
  module Markdown
5
- VERSION = "0.10.3"
7
+ # @private
8
+ VERSION = "0.11.0"
6
9
  end
7
10
  end
@@ -1,4 +1,5 @@
1
- # <%= klass.type.capitalize %> <%= display_name(klass) %> <%= anchor(klass.aref.strip) %>
1
+ <%= anchor(klass.aref.strip) %>
2
+ # <%= klass.type.capitalize %> <%= display_name(klass) %>
2
3
  <%- class_description = describe(klass) -%>
3
4
  <%- unless class_description.empty? -%>
4
5
  <%= class_description %>
@@ -20,7 +21,8 @@
20
21
  ### Constants
21
22
  <% constants.sort_by(&:name).each do |const| -%>
22
23
 
23
- #### `<%= const.name %>` <%= anchor(const.name) %>
24
+ <%= anchor(const.name) %>
25
+ #### `<%= const.name %>`
24
26
  <%= describe(const, fallback: "Not documented.", heading_level_offset: 4) %>
25
27
  <% end -%>
26
28
  <%- end -%>
@@ -29,7 +31,8 @@
29
31
  ### Attributes
30
32
  <% attributes.sort_by(&:name).each do |attr| -%>
31
33
 
32
- #### `<%= attr.name %>` [<%= attr.rw %>] <%= anchor(attr.aref.strip) %>
34
+ <%= anchor(attr.aref.strip) %>
35
+ #### `<%= attr.name %>` [<%= attr.rw %>]
33
36
  <%= describe(attr, fallback: "Not documented.", heading_level_offset: 4) %>
34
37
  <% end -%>
35
38
  <%- end -%>
@@ -41,7 +44,8 @@
41
44
  ### <%= visibility.capitalize %> <%= type.capitalize %> Methods
42
45
  <% methods.each do |method| -%>
43
46
 
44
- #### `<%= method.name %><%= method_signature(method) %>` <%= anchor(method.aref) %>
47
+ <%= anchor(method.aref) %>
48
+ #### `<%= method.name %><%= method_signature(method) %>`
45
49
  <%= method_description(method, current_class: klass) %>
46
50
  <% end -%>
47
51
  <% end -%>
data/mutant.yml CHANGED
@@ -13,3 +13,4 @@ requires:
13
13
  matcher:
14
14
  subjects:
15
15
  - RDoc::Generator::Markdown*
16
+ - ReverseMarkdown::Converters::RDocMarkdownPre*
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdoc-markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.3
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stanislav (Stas) Katkov
@@ -224,6 +224,7 @@ files:
224
224
  - lib/rdoc/discover.rb
225
225
  - lib/rdoc/generator/markdown.rb
226
226
  - lib/rdoc/generator/markdown/rbs_signature_index.rb
227
+ - lib/rdoc/generator/markdown/rdoc_markdown_pre.rb
227
228
  - lib/rdoc/markdown/version.rb
228
229
  - lib/templates/classfile.md.erb
229
230
  - mutant.yml