mdless 1.0.33 → 1.0.37

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: 124d704b9e69d3c7afbba30442cc2e3f3b9ebd92edc16b345c3a5489b64a5823
4
- data.tar.gz: 0e257d07a7c684441140ad2d526711c41127f97af37ae798311d9f04e5f832fd
3
+ metadata.gz: 79e5b5ce0612ca6b58434e65c449761b9f59e9722f3e7ae6abc107a975b793e8
4
+ data.tar.gz: 4e09831ca7e91aaf6d78dfbec3d7eb74ca8e372c51ec202188c4aefedd3e30c8
5
5
  SHA512:
6
- metadata.gz: 621d98dd881546000fdff38ad51e691d1c729fce4a87f96dc19b5041b9fefefd826245ed9b865db272165b591a0d300b6d1c5dca71d2612b611bc9549dce3181
7
- data.tar.gz: 33287f2fd78bdc15fd9bc15003a30df2396688475864063e012d96418c8e390a2c2e6c67c746831608a40e4bea0ee594540e209dbcc6806d3e7950c870406785
6
+ metadata.gz: 304f7590b03f8ab1efb52ef6142a57911167b49d2af7b616f41ae71136aab5fc47a0f772074b76f69c74fc142588be71ee2c507a93bb07c5efb63fb2e92db026
7
+ data.tar.gz: 4f2d406c790457383b6b87f81ab5c9b7a2dd92a9c716582fe3ebf5a58d385a11308fee5c2b405bf8a21e4ee283dc2b5e284bce6b74e273abdb3051056f9c713b
@@ -578,6 +578,34 @@ module CLIMarkdown
578
578
  input = new_content.join("\n")
579
579
  end
580
580
 
581
+ # fenced code block parsing
582
+ input.gsub!(/(?i-m)(^[ \t]*[`~]{3,})([\s\S]*?)\n([\s\S]*?)\1/m) do
583
+ language = nil
584
+ m = Regexp.last_match
585
+ first_indent = m[1].gsub(/\t/, ' ').match(/^ */)[0].size
586
+
587
+ if m[2] && !m[2].strip.empty?
588
+ language = m[2].strip.split(/ /)[0]
589
+ code_block = pad_max(m[3].to_s, '')
590
+ leader = language || 'code'
591
+ else
592
+ first_line = m[3].to_s.split(/\n/)[0]
593
+
594
+ if first_line =~ %r{^\s*#!.*/.+}
595
+ shebang = first_line.match(%r{^\s*#!.*/(?:env )?([^/]+)$})
596
+ language = shebang[1]
597
+ code_block = m[3]
598
+ leader = shebang[1] || 'code'
599
+ else
600
+ code_block = pad_max(m[3].to_s, "#{color('code_block eol')}¬")
601
+ leader = language || 'code'
602
+ end
603
+ end
604
+ leader += xc
605
+
606
+ hiliteCode(language, code_block, leader, first_indent, m[0])
607
+ end
608
+
581
609
  # h_adjust = highest_header(input) - 1
582
610
  # input.gsub!(/^(#+)/) do |m|
583
611
  # match = Regexp.last_match
@@ -622,34 +650,6 @@ module CLIMarkdown
622
650
  end
623
651
  }
624
652
 
625
- # code block parsing
626
- input.gsub!(/(?i-m)(^[ \t]*[`~]{3,})([\s\S]*?)\n([\s\S]*?)\1/m) do
627
- language = nil
628
- m = Regexp.last_match
629
- first_indent = m[1].gsub(/\t/,' ').match(/^ */)[0].size
630
-
631
- if m[2] && m[2].strip.length > 0
632
- language = m[2].strip.split(/ /)[0]
633
- code_block = pad_max(m[3].to_s,'')
634
- leader = language ? language : 'code'
635
- else
636
- first_line = m[3].to_s.split(/\n/)[0]
637
-
638
- if first_line =~ /^\s*#!.*\/.+/
639
- shebang = first_line.match(/^\s*#!.*\/(?:env )?([^\/]+)$/)
640
- language = shebang[1]
641
- code_block = m[3]
642
- leader = shebang[1] ? shebang[1] : 'code'
643
- else
644
- code_block = pad_max(m[3].to_s, "#{color('code_block eol')}¬")
645
- leader = language ? language : 'code'
646
- end
647
- end
648
- leader += xc
649
-
650
- hiliteCode(language, code_block, leader, first_indent, m[0])
651
- end
652
-
653
653
  # remove empty links
654
654
  input.gsub!(/\[(.*?)\]\(\s*?\)/, '\1')
655
655
  input.gsub!(/\[(.*?)\]\[\]/, '[\1][\1]')
@@ -1,3 +1,3 @@
1
1
  module CLIMarkdown
2
- VERSION = '1.0.33'
2
+ VERSION = '1.0.37'
3
3
  end
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.33
4
+ version: 1.0.37
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-06-03 00:00:00.000000000 Z
11
+ date: 2023-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake