mdless 2.1.13 → 2.1.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83167ef6642c2dd16d917eb3bb4f41c7c2ac19dc73ba4450a06bd41f3d044294
4
- data.tar.gz: 5b172f2f5572d107d7f8c0610fb80932faf289dd5aa1e46ed290bcb57880c916
3
+ metadata.gz: ffc20d85c54af629a9fe7b40cb2d070f4b1747cc83a11c8db247dd41552b3fc7
4
+ data.tar.gz: 724e9dd1be0e95b076d4d33a166a06096f25295c60c91209c90a1d3e75010b0e
5
5
  SHA512:
6
- metadata.gz: c63aa55d2e53d7773c4208868d1bfffecaf93224da8843f11a2a74fb339a77bdb2143a54144ed09deb4253e645c484c017e42ea69196f03163b83331301a6f72
7
- data.tar.gz: 1b3ee4f2e46e131d2c2e7a3f015f3eb9dfc57f0382863794f9130e00e34a64d359a9e0b05074568a3c8ec133fcd534ec680df0efb9f4c02c82f6a1728fff2fa4
6
+ metadata.gz: d82b111bdd9266f47d96c56fc5aa3475e29aa2a9076fb25fcaf035f86da4f72cdd91d7ee99b77fef10dcd945ef01cd98caaa7ff29e074d77a9f6fca28ebc81f4
7
+ data.tar.gz: 8d645cf69412688a8b2e4d370442bbd230c4bb22ee40b73b8d3bdb8e6648bdf804c399ff59607018c5b8dec34a1a11a5c54e12fc1825380c496bbed430f52cd9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ 2.1.14
2
+ : Spaces on a line separating metadata won't break display
3
+ : Preserve line breaks in metadata
4
+ : Failure to display metadata fixed
5
+
1
6
  2.1.13
2
7
  : Remove debugging statement
3
8
 
data/README.md CHANGED
@@ -227,7 +227,7 @@ $ gather https://brettterpstra.com/projects/gather-cli/ | mdless
227
227
  [fzf](https://github.com/junegunn/fzf) is a tool for selecting files and other menu options with typeahead fuzzy matching. You can set up `mdless` as a previewer when selecting Markdown or TaskPaper files.
228
228
 
229
229
  ```
230
- $ ls *.md | fzf --preview 'mdless --taskpaper auto --linebreaks {}'
230
+ $ ls *.md | fzf --preview 'mdless {}'
231
231
  ```
232
232
 
233
233
  ### Fish
@@ -262,10 +262,15 @@ module Redcarpet
262
262
  end
263
263
 
264
264
  def paragraph(text)
265
+ text.scrub!
265
266
  out = if MDLess.options[:preserve_linebreaks]
266
267
  "#{xc}#{text.gsub(/ +/, ' ').strip}#{xc}#{x}\n\n"
267
268
  else
268
- "#{xc}#{text.gsub(/ +/, ' ').gsub(/\n+(?![:-])/, ' ').strip}#{xc}#{x}\n\n"
269
+ if text.uncolor =~ / {2,}$/ || text.uncolor =~ /^%/
270
+ "#{xc}#{text.gsub(/ +/, ' ').strip}#{xc}#{x}\n"
271
+ else
272
+ "#{xc}#{text.gsub(/ +/, ' ').gsub(/\n+(?![:-])/, ' ').strip}#{xc}#{x}\n\n"
273
+ end
269
274
  end
270
275
  if MDLess.options[:at_tags] || MDLess.options[:taskpaper]
271
276
  highlight_tags(out)
@@ -755,7 +760,7 @@ module Redcarpet
755
760
  line = "#{color('metadata marker')}#{'%' * longest}"
756
761
  else
757
762
  line.sub!(/^(.*?:)[ \t]+(\S)/, '\1 \2')
758
- line = "#{color('metadata color')}#{line}"
763
+ line = "#{color('metadata marker')}% #{color('metadata color')}#{line}\n"
759
764
  end
760
765
 
761
766
  line += "\u00A0" * (longest - line.uncolor.strip.length) + xc
@@ -766,15 +771,16 @@ module Redcarpet
766
771
 
767
772
  if !in_yaml && first_line =~ /(?i-m)^[\w ]+:\s+\S+/
768
773
  MDLess.log.info('Found MMD Headers')
769
- input.sub!(/(?i-m)^([\S ]+:[\s\S]*?)+(?=\n\n)/) do |mmd|
774
+ input.sub!(/(?i-m)^([\S ]+:[\s\S]*?)+(?=\n *\n)/) do |mmd|
770
775
  lines = mmd.split(/\n/)
771
776
  return mmd if lines.count > 20
772
777
 
773
778
  longest = lines.inject { |memo, word| memo.length > word.length ? memo : word }.length
774
779
  longest = longest < MDLess.cols ? longest + 1 : MDLess.cols
780
+
775
781
  lines.map do |line|
776
782
  line.sub!(/^(.*?:)[ \t]+(\S)/, '\1 \2')
777
- line = "#{color('metadata color')}#{line}"
783
+ line = "#{color('metadata marker')}%#{color('metadata color')}#{line} "
778
784
  line += "\u00A0" * (longest - line.uncolor.strip.length)
779
785
  line + xc
780
786
  end.join("\n") + "#{"\u00A0" * longest}#{xc}\n"
data/lib/mdless/string.rb CHANGED
@@ -74,7 +74,7 @@ class ::String
74
74
  line = "#{color('metadata marker')}#{'%' * longest}"
75
75
  else
76
76
  line.sub!(/^(.*?:)[ \t]+(\S)/, '\1 \2')
77
- line = "#{color('metadata color')}#{line}"
77
+ line = "#{color('metadata color')}#{line}<br>"
78
78
  end
79
79
 
80
80
  line += "\u00A0" * (longest - line.uncolor.strip.length) + xc
@@ -85,7 +85,7 @@ class ::String
85
85
 
86
86
  if !in_yaml && first_line =~ /(?i-m)^[\w ]+:\s+\S+/
87
87
  MDLess.log.info('Found MMD Headers')
88
- input.sub!(/(?i-m)^([\S ]+:[\s\S]*?)+(?=\n\n)/) do |mmd|
88
+ input.sub!(/(?i-m)^([\S ]+:[\s\S]*?)+(?=\n *\n)/) do |mmd|
89
89
  lines = mmd.split(/\n/)
90
90
  return mmd if lines.count > 20
91
91
 
@@ -93,7 +93,7 @@ class ::String
93
93
  longest = longest < @cols ? longest + 1 : @cols
94
94
  lines.map do |line|
95
95
  line.sub!(/^(.*?:)[ \t]+(\S)/, '\1 \2')
96
- line = "#{color('metadata color')}#{line}"
96
+ line = "#{color('metadata color')}#{line}<br>"
97
97
  line += "\u00A0" * (longest - line.uncolor.strip.length)
98
98
  line + xc
99
99
  end.join("\n") + "#{"\u00A0" * longest}#{xc}\n"
@@ -61,9 +61,10 @@ module CLIMarkdown
61
61
  if tasks >= 6
62
62
  return true
63
63
  else
64
- tst = remove_meta(input)
64
+ tst = remove_meta(input.dup)
65
65
  tst = tst.gsub(PROJECT_RX, '')
66
66
  tst = tst.gsub(TASK_RX, '')
67
+ tst = tst.gsub(NOTE_RX, '')
67
68
  tst = tst.gsub(/^ *\n$/, '')
68
69
  return tst.strip.length == 0
69
70
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CLIMarkdown
4
- VERSION = '2.1.13'
4
+ VERSION = '2.1.14'
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.1.13
4
+ version: 2.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra