mdless 2.1.27 → 2.1.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/bin/mdless +1 -1
- data/lib/mdless/converter.rb +40 -33
- data/lib/mdless/string.rb +1 -1
- data/lib/mdless/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e5c2be4377b1bad77f8c7f3e0ab932a16ca9339332c91e3bc5f0b7db8c71df2
|
4
|
+
data.tar.gz: f540f256c1117dab4a9ef0e758f940d3f79a848abe2f15f5b2866e5f2e052656
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b52a6501909c93927e508419298a767aeb759c661b45c877feb33b72caa9f512146ab5fc67a41530666328e5e37ebc53bf25979b0340ee50666433e85f2df920
|
7
|
+
data.tar.gz: da7f8a1949c56474461847ca9b66fccc1dea888552976b2e00b3dea12a250ba3c28cc70bf2496a1293171c4c17300779f68c228ff24ddf9068ff08046492db6e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
2.1.26
|
2
2
|
|
3
|
+
2.1.29
|
4
|
+
: More code cleanup, help output improvements
|
5
|
+
: Line breaks in help output
|
6
|
+
: This release should fix an error on Ruby 2.7 in string.rb
|
7
|
+
|
8
|
+
2.1.28
|
9
|
+
: Default to 0 width, which makes the width the column width of the terminal
|
10
|
+
: Don't save a --width setting to config, require that to be manually updated if desired
|
11
|
+
|
3
12
|
2.1.27
|
4
13
|
: Error handling when YAML can't be processed
|
5
14
|
|
data/bin/mdless
CHANGED
data/lib/mdless/converter.rb
CHANGED
@@ -45,7 +45,8 @@ module CLIMarkdown
|
|
45
45
|
default(:local_images, false)
|
46
46
|
default(:remote_images, false)
|
47
47
|
opts.on('-i', '--images=TYPE',
|
48
|
-
'Include [local|remote (both)|none] images in output
|
48
|
+
'Include [local|remote (both)|none] images in output'\
|
49
|
+
' (requires chafa or imgcat, default none).') do |type|
|
49
50
|
if exec_available('imgcat') || exec_available('chafa')
|
50
51
|
case type
|
51
52
|
when /^(r|b|a)/i
|
@@ -62,7 +63,8 @@ module CLIMarkdown
|
|
62
63
|
end
|
63
64
|
end
|
64
65
|
|
65
|
-
opts.on('-I', '--all-images', 'Include local and remote images in output
|
66
|
+
opts.on('-I', '--all-images', 'Include local and remote images in output'\
|
67
|
+
' (requires imgcat or chafa)') do
|
66
68
|
if exec_available('imgcat') || exec_available('chafa') # && ENV['TERM_PROGRAM'] == 'iTerm.app'
|
67
69
|
MDLess.options[:local_images] = true
|
68
70
|
MDLess.options[:remote_images] = true
|
@@ -114,13 +116,18 @@ module CLIMarkdown
|
|
114
116
|
exit
|
115
117
|
end
|
116
118
|
|
117
|
-
default(:width,
|
118
|
-
opts.on('-w', '--width=COLUMNS', 'Column width to format for (default: terminal width)') do |columns|
|
119
|
-
|
119
|
+
default(:width, 0)
|
120
|
+
opts.on('-w', '--width=COLUMNS', 'Column width to format for (default: 0 -> terminal width)') do |columns|
|
121
|
+
columns = columns.to_i
|
120
122
|
cols = TTY::Screen.cols
|
121
|
-
MDLess.
|
123
|
+
MDLess.cols = columns > 2 ? columns - 2 : cols
|
124
|
+
|
125
|
+
MDLess.options[:width] = columns > cols ? cols - 2 : columns - 2
|
122
126
|
end
|
123
127
|
|
128
|
+
MDLess.cols = MDLess.options[:width]
|
129
|
+
MDLess.cols = TTY::Screen.cols - 2 if MDLess.cols.zero?
|
130
|
+
|
124
131
|
default(:autolink, true)
|
125
132
|
opts.on('--[no-]autolink', 'Convert bare URLs and emails to <links>') do |p|
|
126
133
|
MDLess.options[:autolink] = p
|
@@ -138,8 +145,9 @@ module CLIMarkdown
|
|
138
145
|
Process.exit 0
|
139
146
|
end
|
140
147
|
|
141
|
-
opts.on('--edit-theme',
|
142
|
-
|
148
|
+
opts.on('--edit-theme', 'Open the default/specified theme in ' \
|
149
|
+
"#{File.basename(ENV['EDITOR']) || 'default editor'}, "\
|
150
|
+
'populating a new theme if needed. Use after --theme in the command.') do
|
143
151
|
raise 'No $EDITOR defined' unless ENV['EDITOR']
|
144
152
|
|
145
153
|
theme = MDLess.options[:theme] =~ /default/ ? 'mdless' : MDLess.options[:theme]
|
@@ -150,7 +158,7 @@ module CLIMarkdown
|
|
150
158
|
end
|
151
159
|
|
152
160
|
default(:inline_footnotes, false)
|
153
|
-
opts.on('--[no-]
|
161
|
+
opts.on('--[no-]inline-footnotes',
|
154
162
|
'Display footnotes immediately after the paragraph that references them') do |p|
|
155
163
|
MDLess.options[:inline_footnotes] = p
|
156
164
|
end
|
@@ -167,8 +175,8 @@ module CLIMarkdown
|
|
167
175
|
|
168
176
|
default(:links, :inline)
|
169
177
|
opts.on('--links=FORMAT',
|
170
|
-
'Link style ([inline, reference, paragraph],
|
171
|
-
"paragraph" will position reference links after each paragraph)') do |fmt|
|
178
|
+
'Link style ([*inline, reference, paragraph],'\
|
179
|
+
' "paragraph" will position reference links after each paragraph)') do |fmt|
|
172
180
|
MDLess.options[:links] = case fmt
|
173
181
|
when /^:?r/i
|
174
182
|
:reference
|
@@ -195,26 +203,26 @@ module CLIMarkdown
|
|
195
203
|
end
|
196
204
|
|
197
205
|
MDLess.options[:taskpaper] = if MDLess.options[:taskpaper]
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
206
|
+
case MDLess.options[:taskpaper].to_s
|
207
|
+
when /^[ty1]/
|
208
|
+
true
|
209
|
+
when /^a/
|
210
|
+
:auto
|
211
|
+
else
|
212
|
+
false
|
213
|
+
end
|
214
|
+
else
|
215
|
+
false
|
216
|
+
end
|
209
217
|
opts.on('--taskpaper=OPTION', 'Highlight TaskPaper format (true|false|auto)') do |tp|
|
210
218
|
MDLess.options[:taskpaper] = case tp
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
219
|
+
when /^[ty1]/
|
220
|
+
true
|
221
|
+
when /^a/
|
222
|
+
:auto
|
223
|
+
else
|
224
|
+
false
|
225
|
+
end
|
218
226
|
end
|
219
227
|
|
220
228
|
default(:transclude, true)
|
@@ -223,7 +231,8 @@ module CLIMarkdown
|
|
223
231
|
end
|
224
232
|
|
225
233
|
default(:update_config, false)
|
226
|
-
opts.on('--update-config', '--update_config',
|
234
|
+
opts.on('--update-config', '--update_config',
|
235
|
+
'Update the configuration file with new keys and current command line options') do
|
227
236
|
MDLess.options[:update_config] = true
|
228
237
|
end
|
229
238
|
|
@@ -264,15 +273,13 @@ module CLIMarkdown
|
|
264
273
|
opts.delete(:section)
|
265
274
|
opts.delete(:update_config)
|
266
275
|
opts.delete(:update_theme)
|
267
|
-
opts
|
276
|
+
opts[:width] = 0
|
268
277
|
opts = opts.keys.map(&:to_s).sort.map { |k| [k.to_sym, opts[k.to_sym]] }.to_h
|
269
278
|
f.puts YAML.dump(opts)
|
270
279
|
warn "Config file saved to #{config}"
|
271
280
|
end
|
272
281
|
end
|
273
282
|
|
274
|
-
MDLess.cols = MDLess.options[:width] - 2
|
275
|
-
|
276
283
|
@output = ''
|
277
284
|
@headers = []
|
278
285
|
@setheaders = []
|
data/lib/mdless/string.rb
CHANGED
@@ -67,7 +67,7 @@ class ::String
|
|
67
67
|
input.sub!(/(?i-m)^---[ \t]*\n(?<content>[\s\S]*?)\n[-.]{3}[ \t]*\n/m) do
|
68
68
|
m = Regexp.last_match
|
69
69
|
MDLess.log.info('Processing YAML Header')
|
70
|
-
|
70
|
+
YAML.load(m['content']).map { |k, v| MDLess.meta[k.downcase] = v }
|
71
71
|
lines = m['content'].split(/\n/)
|
72
72
|
longest = lines.inject { |memo, word| memo.length > word.length ? memo : word }.length
|
73
73
|
longest = longest < @cols ? longest + 1 : @cols
|
data/lib/mdless/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mdless
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-12-
|
11
|
+
date: 2023-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redcarpet
|
@@ -158,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '0'
|
160
160
|
requirements: []
|
161
|
-
rubygems_version: 3.
|
161
|
+
rubygems_version: 3.4.0.dev
|
162
162
|
signing_key:
|
163
163
|
specification_version: 4
|
164
164
|
summary: A pager like less, but for Markdown files
|