mdless 2.0.20 → 2.0.22

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: a4af619d93405da0eb2861158c261c7cd2c494530f32c3e5de2a8be9b4c7d713
4
- data.tar.gz: 17c466f16b258b5959be6ac0f2540594a36b3319007692897200999749c34cc1
3
+ metadata.gz: 7000551956e5384e5c516ac84ce7f709a822e668483b6b921c51af8835928174
4
+ data.tar.gz: f5954f572cd89adcf03f2c09dff5721eb143b463cea043249e564792a035c381
5
5
  SHA512:
6
- metadata.gz: 36f0963f1629e9cf7f65576c6340dc1bd1fd2ee8e2f47ccf9cde5852581db3a502804e571b28b3501f1a3dc9b29ea0c214eb504b9771c89bed27fd6ce9147377
7
- data.tar.gz: d39dcf70ca3b26573f9459489b4ca3aafaa9f3d014d83d63aa76e0d4dbe37138a8c25b421b9b00457d9c6ab105b8fdbd3cf6fb85f6549d4963ae72694bc6e4ab
6
+ metadata.gz: b047fc7a13a8b3686f6ed5d4e6e0dce551bf63cfab04430e546b47aa1eeb0b60d8c8463988d2741ccfb833020a8afaec082cee04995185e1de75ad67a731640b
7
+ data.tar.gz: a61fed5f455b428044a17b118e78260377bc5fc7bb9b5292e6718ffbb0c847cce6a26d5e1e0f21c854ea905cc100167cd24ed0060e7256b540bf25aa248aaaca
@@ -229,7 +229,11 @@ module Redcarpet
229
229
  end
230
230
 
231
231
  def paragraph(text)
232
- "#{xc}#{text}#{xc}#{x}\n\n"
232
+ if MDLess.options[:preserve_linebreaks]
233
+ "#{xc}#{text.gsub(/ +/, ' ').strip}#{xc}#{x}\n\n"
234
+ else
235
+ "#{xc}#{text.gsub(/ +/, ' ').gsub(/\n+/, ' ').strip}#{xc}#{x}\n\n"
236
+ end
233
237
  end
234
238
 
235
239
  @table_cols = nil
@@ -427,7 +431,7 @@ module Redcarpet
427
431
  end
428
432
 
429
433
  def link(link, title, content)
430
- res = color_link(link, title, content)
434
+ res = color_link(link, title&.strip, content&.strip)
431
435
  @@links << {
432
436
  link: res,
433
437
  url: link,
@@ -581,7 +585,7 @@ module Redcarpet
581
585
  end.join("\n"), indent)
582
586
  next if list.nil?
583
587
 
584
- "<<main#{m['id']}>>#{list}<</main#{m['id']}>>"
588
+ "<<main#{m['id']}>>#{list}<</main#{m['id']}>>\n\n"
585
589
  end
586
590
 
587
591
  input.gsub(/^(?<indent> +)<<main(?<id>\d+)>>(?<content>.*?)<<\/main\k<id>>>/m) do
@@ -786,11 +790,11 @@ module Redcarpet
786
790
  links_added = false
787
791
 
788
792
  @@links.each do |link|
789
- if graf =~ /#{Regexp.escape(link[:link])}/
793
+ if graf =~ /#{Regexp.escape(link[:link].gsub(/\n/, ' '))}/
790
794
  url = link[:url].uncolor
791
795
  content = link[:content]
792
796
  title = link[:title]&.uncolor
793
- graf.gsub!(/#{Regexp.escape(link[:link])}/, color_link_reference(url, counter, content))
797
+ graf.gsub!(/#{Regexp.escape(link[:link].gsub(/\n/, ' '))}/, color_link_reference(url, counter, content))
794
798
  if MDLess.options[:links] == :paragraph
795
799
  if links_added
796
800
  graf += "\n#{color_reference_link(url, title, counter)}"
@@ -156,9 +156,14 @@ module CLIMarkdown
156
156
  end
157
157
  end
158
158
 
159
+ default(:preserve_linebreaks, false)
160
+ opts.on('--[no-]linebreaks', 'Preserve line breaks') do |opt|
161
+ MDLess.options[:preserve_linebreaks] = opt
162
+ end
163
+
159
164
  default(:syntax_higlight, false)
160
- opts.on('--[no-]syntax', 'Syntax highlight code blocks') do |p|
161
- MDLess.options[:syntax_higlight] = p
165
+ opts.on('--[no-]syntax', 'Syntax highlight code blocks') do |opt|
166
+ MDLess.options[:syntax_higlight] = opt
162
167
  end
163
168
 
164
169
  MDLess.options[:taskpaper] = if MDLess.options[:taskpaper]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CLIMarkdown
4
- VERSION = '2.0.20'
4
+ VERSION = '2.0.22'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mdless
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.20
4
+ version: 2.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra