mdtoc 0.4.0 → 0.4.2

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: f53365d2172397bc4b50a26f88ce05d13c8766453b56c96fd1513151b2d72cad
4
- data.tar.gz: c49f859803c2bf3928c51f70535ba35a9bffda3ccc69457713977497c6a50f6e
3
+ metadata.gz: 18181b859f98c2413c06fc51d9cb02d6350eda1e82953019dc7007e48a00784b
4
+ data.tar.gz: 6bcd6502f07056de61e2ac6679b296338babbfd5470b731a2a7ca6ccc0f06259
5
5
  SHA512:
6
- metadata.gz: de596f6886429e537d249cc2c2516521cfb23ee8c407f002348a68fe93b3de30f0b6e4809d64c5c2e75858e33791e4507d9060c35c79a8f0459202c105e54b73
7
- data.tar.gz: 8da62161d757e8be2c7970ed076b58ea1dbc0b1416e35d497dbc5545faf84764ab88e08895f21c3995e98acd2c1f0f88bec4c9b96b5bcb3f27ad6a80ef07b88e
6
+ metadata.gz: 8045d2d699f6f6fcdd5d2c5671ed08950c279f3a6c3d836f149f1bfc7d8edad60582cf2539f2e042ebabde2b99b3eb7ccf0b6c3476fb294ba170afbe9c787b6f
7
+ data.tar.gz: d077544177ade528172c9642df28174c596ba663e658ea36b838d8fc616eb662960be342fa030137a987eace0e2615389c339562d1cde09997038d9416f866f5
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # mdtoc - Markdown Table of Contents
2
2
 
3
+ [![CI](https://github.com/andornaut/mdtoc/actions/workflows/release.yml/badge.svg)](https://github.com/andornaut/mdtoc/actions/workflows/release.yml)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
3
6
  Read Markdown files and output a table of contents.
4
7
 
5
8
  ## Installation
@@ -40,10 +43,9 @@ Usage: mdtoc [options] files or directories...
40
43
  Create a `Rakefile` with the contents below, then run
41
44
  [`rake`](https://github.com/ruby/rake) to:
42
45
 
43
- * `git pull`
44
- * `git add` any `*.md` files
45
46
  * Run `mdtoc` to update the generated table of contents in the ./README.md file
46
- * Git commit and push any changes
47
+ * `git add` any `*.md` files
48
+ * Git commit, pull, and push any changes
47
49
 
48
50
  ```ruby
49
51
  task default: %w[mdtoc]
@@ -57,7 +59,7 @@ task :mdtoc do
57
59
  exit 1
58
60
  fi
59
61
  mdtoc --append --create --output README.md docs/
60
- git add *.md **/*.md
62
+ git add README.md docs/*.md
61
63
  git commit -qm 'Update TOC' || true
62
64
  git pull
63
65
  git push
@@ -70,9 +72,9 @@ task :mdtoc do
70
72
  end
71
73
  ```
72
74
 
73
- See [andornaut/til](https://github.com/andornaut/til/blob/master/Rakefile) for an example.
75
+ See [andornaut/til](https://github.com/andornaut/til/blob/main/Rakefile) for an example.
74
76
 
75
- ## Development
77
+ ## Developing
76
78
 
77
79
  ### Setup
78
80
 
@@ -110,4 +112,14 @@ f=$(mktemp) && ruby -Ilib bin/mdtoc -aco ${f} test/samples ; cat ${f}
110
112
  1. Bump version in `lib/mdtoc/version.rb`
111
113
  2. Run `bundle install` to update `Gemfile.lock`
112
114
  3. Commit the changes
113
- 4. Run `rake release` to publish the gem to RubyGems, create the git tag, and push
115
+ 4. Tag the commit `vX.Y.Z` and push the tag
116
+
117
+ Pushing the tag is the whole release. The Release workflow runs the checks,
118
+ builds the gem, cuts the GitHub release, and pushes that same gem to RubyGems.
119
+ `rake release` is not run by hand.
120
+
121
+ Nothing here holds a RubyGems API key. The workflow authenticates with a
122
+ short-lived credential minted from its own OIDC claim, against a trusted
123
+ publisher registered on RubyGems that names this repository and
124
+ `.github/workflows/release.yml`. Renaming that file stops publishing until the
125
+ trusted publisher is updated to match.
data/bin/mdtoc CHANGED
@@ -2,5 +2,5 @@
2
2
  # typed: true
3
3
  # frozen_string_literal: true
4
4
 
5
- require "mdtoc"
5
+ require 'mdtoc'
6
6
  Mdtoc.main(ARGV)
data/lib/mdtoc/node.rb CHANGED
@@ -28,9 +28,7 @@ module Mdtoc
28
28
  def render(paths)
29
29
  headers = paths.flat_map { |path| for_path(path).headers }
30
30
  min_depth = headers.map(&:depth).min || 0
31
- if min_depth.positive?
32
- headers.each { |h| h.depth -= min_depth }
33
- end
31
+ headers.each { |h| h.depth -= min_depth } if min_depth.positive?
34
32
  headers.join("\n")
35
33
  end
36
34
  end
data/lib/mdtoc/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Mdtoc
5
- VERSION = '0.4.0'
5
+ VERSION = '0.4.2'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mdtoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - andornaut
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-25 00:00:00.000000000 Z
11
+ date: 2026-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.12.0
75
+ version: 0.13.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.12.0
82
+ version: 0.13.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: unparser
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -111,6 +111,9 @@ dependencies:
111
111
  description: |
112
112
  # mdtoc - Markdown Table of Contents
113
113
 
114
+ [![CI](https://github.com/andornaut/mdtoc/actions/workflows/release.yml/badge.svg)](https://github.com/andornaut/mdtoc/actions/workflows/release.yml)
115
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
116
+
114
117
  Read Markdown files and output a table of contents.
115
118
 
116
119
  ## Installation
@@ -151,10 +154,9 @@ description: |
151
154
  Create a `Rakefile` with the contents below, then run
152
155
  [`rake`](https://github.com/ruby/rake) to:
153
156
 
154
- * `git pull`
155
- * `git add` any `*.md` files
156
157
  * Run `mdtoc` to update the generated table of contents in the ./README.md file
157
- * Git commit and push any changes
158
+ * `git add` any `*.md` files
159
+ * Git commit, pull, and push any changes
158
160
 
159
161
  ```ruby
160
162
  task default: %w[mdtoc]
@@ -168,7 +170,7 @@ description: |
168
170
  exit 1
169
171
  fi
170
172
  mdtoc --append --create --output README.md docs/
171
- git add *.md **/*.md
173
+ git add README.md docs/*.md
172
174
  git commit -qm 'Update TOC' || true
173
175
  git pull
174
176
  git push
@@ -181,9 +183,9 @@ description: |
181
183
  end
182
184
  ```
183
185
 
184
- See [andornaut/til](https://github.com/andornaut/til/blob/master/Rakefile) for an example.
186
+ See [andornaut/til](https://github.com/andornaut/til/blob/main/Rakefile) for an example.
185
187
 
186
- ## Development
188
+ ## Developing
187
189
 
188
190
  ### Setup
189
191
 
@@ -221,7 +223,17 @@ description: |
221
223
  1. Bump version in `lib/mdtoc/version.rb`
222
224
  2. Run `bundle install` to update `Gemfile.lock`
223
225
  3. Commit the changes
224
- 4. Run `rake release` to publish the gem to RubyGems, create the git tag, and push
226
+ 4. Tag the commit `vX.Y.Z` and push the tag
227
+
228
+ Pushing the tag is the whole release. The Release workflow runs the checks,
229
+ builds the gem, cuts the GitHub release, and pushes that same gem to RubyGems.
230
+ `rake release` is not run by hand.
231
+
232
+ Nothing here holds a RubyGems API key. The workflow authenticates with a
233
+ short-lived credential minted from its own OIDC claim, against a trusted
234
+ publisher registered on RubyGems that names this repository and
235
+ `.github/workflows/release.yml`. Renaming that file stops publishing until the
236
+ trusted publisher is updated to match.
225
237
  email:
226
238
  executables:
227
239
  - mdtoc
@@ -253,7 +265,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
253
265
  requirements:
254
266
  - - ">="
255
267
  - !ruby/object:Gem::Version
256
- version: 3.1.0
268
+ version: 3.2.0
257
269
  required_rubygems_version: !ruby/object:Gem::Requirement
258
270
  requirements:
259
271
  - - ">="