mdless 2.1.4 → 2.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/lib/mdless/colors.rb +8 -1
- data/lib/mdless/console.rb +3 -2
- data/lib/mdless/converter.rb +15 -0
- data/lib/mdless/tables.rb +1 -1
- data/lib/mdless/theme.rb +1 -0
- data/lib/mdless/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a7d200fbf2d90da97cf6ae65beecac52643ec377d2a60f7d8503ca2411694ea
|
4
|
+
data.tar.gz: f35b88bdf439f3436ddf2e6cf0b835e8a23d5d5553721b0c35d75954af43013e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 906870b0032f1cba0a1c90be6ac2cb80f82c1abcb331470f75b02598d05d965996b2d2eb0a076b2651e32e9ae567334b693a9dffd702b517e15c5b8048f2e172
|
7
|
+
data.tar.gz: e1874c241362b44607a357ec4e125bdc463ae3b3ab906bdf7237e1b782a6122b6f90d664210cf7dd1b964bf843adb1056adbacdd93b816f0bb31db4d92ad1cf5
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
-
2.1.
|
1
|
+
2.1.7
|
2
|
+
: Dedup and remove empty escape codes before output
|
3
|
+
: Tables losing column alignment
|
4
|
+
: Unneccessarily long table cells
|
5
|
+
|
6
|
+
2.1.6
|
2
7
|
: In addition to color names, you can now use 3 or 6-digit hex codes, prefix with "bg" or "on_" to affect background color
|
3
8
|
: Better highlighting of h1/h2 when header contains a link
|
4
9
|
: List items with multiple paragraphs incorrectly highlighted
|
data/lib/mdless/colors.rb
CHANGED
@@ -58,6 +58,10 @@ module CLIMarkdown
|
|
58
58
|
self.unpad.gsub(/\e\[[\d;]+m/,'')
|
59
59
|
end
|
60
60
|
|
61
|
+
def remove_pre_post
|
62
|
+
gsub(/<<(pre|post)\d+>>/, '')
|
63
|
+
end
|
64
|
+
|
61
65
|
def unpad
|
62
66
|
self.gsub(/\u00A0/, ' ')
|
63
67
|
end
|
@@ -155,10 +159,13 @@ module CLIMarkdown
|
|
155
159
|
line = last_ansi + word
|
156
160
|
else
|
157
161
|
visible_width += word.size_clean + 1
|
158
|
-
line <<
|
162
|
+
line << ' ' << last_ansi + word
|
159
163
|
end
|
160
164
|
end
|
161
165
|
lines << line + match(/\s*$/)[0] + xc(foreground) if line
|
166
|
+
lines.map!.with_index do |l, i|
|
167
|
+
(i.positive? ? l[i - 1].last_color_code : '') + l
|
168
|
+
end
|
162
169
|
lines.join("\n").gsub(/\[.*?\]\(.*?\)/) do |link|
|
163
170
|
link.gsub(/\u00A0/, ' ')
|
164
171
|
end
|
data/lib/mdless/console.rb
CHANGED
@@ -263,13 +263,13 @@ module Redcarpet
|
|
263
263
|
end
|
264
264
|
|
265
265
|
def table(header, body)
|
266
|
-
@header_row = []
|
267
266
|
formatted = CLIMarkdown::MDTableCleanup.new([
|
268
267
|
"#{header}",
|
269
268
|
table_header_row,
|
270
269
|
"|\n",
|
271
270
|
"#{body}\n\n"
|
272
271
|
].join(''))
|
272
|
+
@header_row = []
|
273
273
|
res = formatted.to_md
|
274
274
|
"#{color_table(res)}\n\n"
|
275
275
|
# res
|
@@ -555,7 +555,8 @@ module Redcarpet
|
|
555
555
|
[
|
556
556
|
indent,
|
557
557
|
color('list bullet'),
|
558
|
-
|
558
|
+
MDLess.theme['list']['ul_char'],
|
559
|
+
' ',
|
559
560
|
color('list color'),
|
560
561
|
indent_lines(content, indent).strip,
|
561
562
|
xc
|
data/lib/mdless/converter.rb
CHANGED
@@ -460,6 +460,20 @@ module CLIMarkdown
|
|
460
460
|
input
|
461
461
|
end
|
462
462
|
|
463
|
+
def clean_escapes(input)
|
464
|
+
out = input.gsub(/\e\[m/, '')
|
465
|
+
last_escape = ''
|
466
|
+
out.gsub!(/\e\[(?:(?:(?:[349]|10)[0-9]|[0-9])?;?)+m/) do |m|
|
467
|
+
if m == last_escape
|
468
|
+
''
|
469
|
+
else
|
470
|
+
last_escape = m
|
471
|
+
m
|
472
|
+
end
|
473
|
+
end
|
474
|
+
out.gsub(/\e\[0m/, '')
|
475
|
+
end
|
476
|
+
|
463
477
|
def update_inline_links(input)
|
464
478
|
links = {}
|
465
479
|
counter = 1
|
@@ -544,6 +558,7 @@ module CLIMarkdown
|
|
544
558
|
end
|
545
559
|
|
546
560
|
out = clean_markers(out)
|
561
|
+
out = clean_escapes(out)
|
547
562
|
out = "#{out.gsub(/\n{2,}/m, "\n\n")}#{xc}"
|
548
563
|
|
549
564
|
out.uncolor! unless MDLess.options[:color]
|
data/lib/mdless/tables.rb
CHANGED
data/lib/mdless/theme.rb
CHANGED
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.7
|
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-
|
11
|
+
date: 2023-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redcarpet
|