mdless 1.0.17 → 1.0.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -1
- data/lib/mdless/converter.rb +10 -3
- data/lib/mdless/theme.rb +5 -5
- data/lib/mdless/version.rb +1 -1
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6d1b744e285d103ea81159c8663b7158a26d8609cd7411ca47c6451cf896ea8
|
4
|
+
data.tar.gz: 9b42221d8ed826e288067b56237af338c320c996fb57215784547ce57cc3b8f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e168c66bc6eaf8cf30303ac4e8e33469d1d43c38c546b081aaccf5dd9cc7888aecef892e315036fa4c73c8a3bb4fe2887b35ae40169c9d3d18d60a882738c07
|
7
|
+
data.tar.gz: c57f891b278a448527a9ce432d5536ef09a1706132c233a27c62a44fdf273ccb6e030ca3227965f191634d3bfbc21fb4c1a4f80e28a3aed4f97e4f202178cf05
|
data/README.md
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
# mdless
|
3
2
|
|
4
3
|
`mdless` is a utility that provides a formatted and highlighted view of Markdown files in Terminal.
|
@@ -27,6 +26,14 @@ I often use iTerm2 in visor mode, so `qlmanage -p` is annoying. I still wanted a
|
|
27
26
|
|
28
27
|
gem install mdless
|
29
28
|
|
29
|
+
### Dependencies
|
30
|
+
|
31
|
+
Some OSs are missing `tput`, which is necessary for mdless.
|
32
|
+
|
33
|
+
apt update
|
34
|
+
apt install ruby ncurses-utils
|
35
|
+
gem install mdless
|
36
|
+
|
30
37
|
## Usage
|
31
38
|
|
32
39
|
`mdless [options] path` or `cat [path] | mdless`
|
data/lib/mdless/converter.rb
CHANGED
@@ -105,7 +105,12 @@ module CLIMarkdown
|
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
|
-
|
108
|
+
begin
|
109
|
+
optparse.parse!
|
110
|
+
rescue OptionParser::ParseError => pe
|
111
|
+
$stderr.puts "error: #{pe.message}"
|
112
|
+
exit 1
|
113
|
+
end
|
109
114
|
|
110
115
|
@theme = load_theme(@options[:theme])
|
111
116
|
@cols = @options[:width]
|
@@ -340,6 +345,8 @@ module CLIMarkdown
|
|
340
345
|
|
341
346
|
def clean_markers(input)
|
342
347
|
input.gsub!(/^(\e\[[\d;]+m)?[%~] ?/,'\1')
|
348
|
+
input.gsub!(/^(\e\[[\d;]+m)*>(\e\[[\d;]+m)?( +)/,' \3\1\2')
|
349
|
+
input.gsub!(/^(\e\[[\d;]+m)*>(\e\[[\d;]+m)?/,'\1\2')
|
343
350
|
input.gsub!(/(\e\[[\d;]+m)?@@@(\e\[[\d;]+m)?$/,'')
|
344
351
|
input
|
345
352
|
end
|
@@ -432,8 +439,8 @@ module CLIMarkdown
|
|
432
439
|
new_code_line = l.gsub(/\t/, ' ')
|
433
440
|
new_code_line.sub!(/^#{" "*first_indent}/,'')
|
434
441
|
[
|
435
|
-
color('code_block marker'),
|
436
442
|
"> ",
|
443
|
+
color('code_block marker'),
|
437
444
|
" "*first_indent,
|
438
445
|
"#{color('code_block bg')}#{l}"
|
439
446
|
].join
|
@@ -449,8 +456,8 @@ module CLIMarkdown
|
|
449
456
|
new_code_line.sub!(/^#{" "*first_indent}/,'')
|
450
457
|
new_code_line.gsub!(/ /, "#{color('code_block color')} ")
|
451
458
|
[
|
452
|
-
color('code_block marker'),
|
453
459
|
"> ",
|
460
|
+
color('code_block marker'),
|
454
461
|
" "*first_indent,
|
455
462
|
color('code_block color'),
|
456
463
|
new_code_line,
|
data/lib/mdless/theme.rb
CHANGED
@@ -93,11 +93,11 @@ module CLIMarkdown
|
|
93
93
|
new_theme = YAML.load(IO.read(theme_file))
|
94
94
|
begin
|
95
95
|
theme = THEME_DEFAULTS.deep_merge(new_theme)
|
96
|
-
# write merged theme back in case there are new keys since
|
97
|
-
# last updated
|
98
|
-
File.open(theme_file,'w') {|f|
|
99
|
-
|
100
|
-
}
|
96
|
+
# # write merged theme back in case there are new keys since
|
97
|
+
# # last updated
|
98
|
+
# File.open(theme_file,'w') {|f|
|
99
|
+
# f.puts theme.to_yaml
|
100
|
+
# }
|
101
101
|
rescue
|
102
102
|
@log.warn('Error merging user theme')
|
103
103
|
theme = THEME_DEFAULTS
|
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: 1.0.
|
4
|
+
version: 1.0.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -44,20 +44,6 @@ dependencies:
|
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: 4.1.1
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: aruba
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
51
|
-
- - "~>"
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
58
|
-
- - "~>"
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '0'
|
61
47
|
description: A CLI that provides a formatted and highlighted view of Markdown files
|
62
48
|
in a terminal
|
63
49
|
email: me@brettterpstra.com
|
@@ -103,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
89
|
- !ruby/object:Gem::Version
|
104
90
|
version: '0'
|
105
91
|
requirements: []
|
106
|
-
rubygems_version: 3.
|
92
|
+
rubygems_version: 3.2.16
|
107
93
|
signing_key:
|
108
94
|
specification_version: 4
|
109
95
|
summary: A pager like less, but for Markdown files
|