kramdown-ansi 0.2.0 → 0.3.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: df9bedd2874bdb7a5df692fd4de8aa0f45c7229f34e52949c373f59a51029729
4
- data.tar.gz: 815611deb77a20eeabfaff76f859607947139aee185aad9f87f2ea4eac8bdf30
3
+ metadata.gz: 657384fbba567a6cdedd1967e08e21d4ae22d47bb33ce02faf2909ae9658de6e
4
+ data.tar.gz: ec6b5e6cb7da4309f0630b00f0e6610f9d9e17f0596ac27187dfeaaa66a7c056
5
5
  SHA512:
6
- metadata.gz: 140e9340a37b9a97fab71289203bac0cb5c2437ff1e0c5b89b78c7bdb4d10e2333475d0e939cfabed5a38127250b4651e1fdb3914396beb50a75c9982eb06de2
7
- data.tar.gz: 1d71d051b792244a649e68af967f65d744985e74f99f03f2305415592d8beca583a6ad8035fbd8f24c404abf570fe8ec95f15540dfe416b93859974da31c18c1
6
+ metadata.gz: f2778dc227dbe7d171e1fc0e7c8155341172d07e28481d8971fb76ac9ef408dca723dcaa07f62637aaa8db8dd96fe8b6a62f06031c8201d414abe7d13b2a3c9d
7
+ data.tar.gz: 41dc68f850e1cd48ea2095a1415760b85ff18efac343b321dcd2b72ab37e4fe9291abd481b61dd9b5b249468176755dcf1bf52e5f6e7493a5d9ee8529e5bd621
data/CHANGES.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # Changes
2
2
 
3
+ ## 2025-12-09 v0.3.0
4
+
5
+ - Added documentation link to README
6
+ - Added GitHub Actions workflow file `.github/workflows/static.yml` for static
7
+ site deployment to GitHub Pages
8
+ - Configured GitHub Actions workflow to run on `master` branch pushes and
9
+ manual dispatch with appropriate permissions
10
+ - Implemented deployment job using `ubuntu-latest` runner with steps for
11
+ checkout, setup Pages, setup Ruby **3.4**, documentation generation, artifact
12
+ upload, and deployment
13
+ - Updated `Rakefile` to include `github_workflows` configuration for the new
14
+ `static.yml` workflow
15
+ - Updated gem dependencies in `kramdown-ansi.gemspec` to use RubyGems version
16
+ **3.7.2** instead of **3.6.9**
17
+ - Updated `gem_hadar` development dependency from version **~> 2.6** to **~>
18
+ 2.8**
19
+ - Modified `lib/kramdown/ansi/pager.rb` to improve documentation and yield both
20
+ output stream and process ID to the block
21
+ - Added new test case in `spec/kramdown/ansi/pager_spec.rb` to verify that the
22
+ `pager` method yields both output and pid to the block
23
+ - Enhanced the `pager` method documentation to better describe its
24
+ functionality and parameters
25
+ - Added `bundle install --jobs=$(getconf _NPROCESSORS_ONLN)` command to utilize
26
+ all available CPU cores during gem installation
27
+ - Updated `gem_hadar` development dependency from version **2.2** to **2.6**
28
+ - Modified `package_ignore` in `Rakefile` to explicitly ignore `.github`
29
+ directory instead of using glob pattern `'.github/**/*'`
30
+ - Added `RUN gem update --system` to update RubyGems to **latest** version in
31
+ CI configuration
32
+ - Added `bundle update` command to update bundle dependencies in CI
33
+ configuration
34
+
3
35
  ## 2025-09-09 v0.2.0
4
36
 
5
37
  - Updated required Ruby version requirement from **~> 3.0** to **~> 3.1**
data/README.md CHANGED
@@ -5,6 +5,10 @@
5
5
  **Kramdown::ANSI**: A library for rendering Markdown(ish) documents with beautiful
6
6
  ANSI escape sequences _in the terminal_.
7
7
 
8
+ ## Documentation
9
+
10
+ Complete API documentation is available at: [GitHub.io](https://flori.github.io/kramdown-ansi/)
11
+
8
12
  ## Installation (gem & bundler)
9
13
 
10
14
  To install Kramdown::ANSI, you can use the following methods:
data/Rakefile CHANGED
@@ -19,11 +19,15 @@ GemHadar do
19
19
  '.yardoc', 'doc', 'tags', 'errors.lst', 'cscope.out', 'coverage', 'tmp',
20
20
  'yard'
21
21
  package_ignore '.all_images.yml', '.tool-versions', '.gitignore', 'VERSION',
22
- '.rspec', *Dir.glob('.github/**/*', File::FNM_DOTMATCH)
22
+ '.rspec', '.github'
23
23
  readme 'README.md'
24
24
 
25
25
  executables << 'md' << 'git-md'
26
26
 
27
+ github_workflows(
28
+ 'static.yml' => {}
29
+ )
30
+
27
31
  required_ruby_version '~> 3.1'
28
32
 
29
33
  dependency 'term-ansicolor', '~> 1.11'
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: kramdown-ansi 0.2.0 ruby lib
2
+ # stub: kramdown-ansi 0.3.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "kramdown-ansi".freeze
6
- s.version = "0.2.0".freeze
6
+ s.version = "0.3.0".freeze
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
@@ -18,13 +18,13 @@ Gem::Specification.new do |s|
18
18
  s.licenses = ["MIT".freeze]
19
19
  s.rdoc_options = ["--title".freeze, "Kramdown-ansi - Output markdown in the terminal with ANSI escape sequences".freeze, "--main".freeze, "README.md".freeze]
20
20
  s.required_ruby_version = Gem::Requirement.new("~> 3.1".freeze)
21
- s.rubygems_version = "3.6.9".freeze
21
+ s.rubygems_version = "3.7.2".freeze
22
22
  s.summary = "Output markdown in the terminal with ANSI escape sequences".freeze
23
23
  s.test_files = ["spec/kramdown/ansi/pager_spec.rb".freeze, "spec/kramdown/ansi/styles_spec.rb".freeze, "spec/kramdown/ansi/width_spec.rb".freeze, "spec/kramdown/ansi_spec.rb".freeze, "spec/spec_helper.rb".freeze]
24
24
 
25
25
  s.specification_version = 4
26
26
 
27
- s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 2.2".freeze])
27
+ s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 2.8".freeze])
28
28
  s.add_development_dependency(%q<all_images>.freeze, ["~> 0.4".freeze])
29
29
  s.add_development_dependency(%q<rspec>.freeze, ["~> 3.2".freeze])
30
30
  s.add_development_dependency(%q<debug>.freeze, [">= 0".freeze])
@@ -18,21 +18,25 @@ require 'term/ansicolor'
18
18
  module Kramdown::ANSI::Pager
19
19
  module_function
20
20
 
21
- # If called without a block returns either the provided command for paging if
22
- # the given number of lines are exceeding the available number of terminal
23
- # lines or nil. If a block was provided it yields to an IO handle for the
24
- # pager command in the latter case or STDOUT in the former.
21
+ # The pager method manages terminal output paging functionality
25
22
  #
26
- # @param command [String] the pager command (optional)
27
- # @param lines [Integer] the number of lines in the output (optional)
28
- # @yield [IO] yields the output IO handle for further processing
29
- # @return [NilClass] returns nil if STDOUT is used or STDOUT is not a TTY.
23
+ # This method handles the logic for determining when to use a pager command
24
+ # like 'less' or 'more' when the output exceeds the terminal's line capacity.
25
+ # It also manages the execution of these pagers and ensures proper terminal
26
+ # state restoration when paging is used.
27
+ #
28
+ # @param command [String] the pager command to use when paging is needed
29
+ # @param lines [Integer] the number of lines to compare against terminal height
30
+ # @yield [output, pid] when a block is provided, yields the output stream and child's process ID
31
+ # @yieldparam output [IO] the IO stream to write output to
32
+ # @yieldparam pid [Integer] the process ID of the pager subprocess
33
+ # @return [String, nil] the pager command string if paging was used, nil otherwise
30
34
  def pager(command: nil, lines: nil, &block)
31
35
  if block
32
36
  if my_pager = pager(command:, lines:)
33
37
  IO.popen(my_pager, 'w') do |output|
34
38
  output.sync = true
35
- yield output
39
+ yield output, output.pid
36
40
  rescue Interrupt, Errno::EPIPE
37
41
  pager_reset_screen
38
42
  return nil
@@ -1,6 +1,6 @@
1
1
  module Kramdown
2
2
  # Kramdown version
3
- VERSION = '0.2.0'
3
+ VERSION = '0.3.0'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -47,6 +47,19 @@ describe Kramdown::ANSI::Pager do
47
47
  expect(result).to eq command
48
48
  end
49
49
 
50
+ it 'yields to output and pid' do
51
+ expect(Tins::Terminal).to receive(:lines).and_return 25
52
+ child_pid = nil
53
+ result = Kramdown::ANSI::Pager.pager(command: command, lines: 30) do |output, pid|
54
+ expect(pid).to be_a Integer
55
+ expect(output).to be_a IO
56
+ expect(output).not_to eq STDOUT
57
+ child_pid = pid
58
+ end
59
+ expect(child_pid).to be_a Integer
60
+ expect(result).to eq command
61
+ end
62
+
50
63
  it 'closes output for Interrupt' do
51
64
  expect(Tins::Terminal).to receive(:lines).and_return 25
52
65
  block_called = false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kramdown-ansi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: '2.2'
18
+ version: '2.8'
19
19
  type: :development
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: '2.2'
25
+ version: '2.8'
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: all_images
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -195,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
195
195
  - !ruby/object:Gem::Version
196
196
  version: '0'
197
197
  requirements: []
198
- rubygems_version: 3.6.9
198
+ rubygems_version: 3.7.2
199
199
  specification_version: 4
200
200
  summary: Output markdown in the terminal with ANSI escape sequences
201
201
  test_files: