mdless 1.0.35 → 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: 6dce520c83c9816d3124e96eefd5f76af0fdb7f1b98515d1b1cbe2dd602fa34e
4
- data.tar.gz: fa054888f473b9cab79cdd4446d39092d0e947f20e4feecccc07ff47ab55fc55
3
+ metadata.gz: 79e5b5ce0612ca6b58434e65c449761b9f59e9722f3e7ae6abc107a975b793e8
4
+ data.tar.gz: 4e09831ca7e91aaf6d78dfbec3d7eb74ca8e372c51ec202188c4aefedd3e30c8
5
5
  SHA512:
6
- metadata.gz: e932ba8df8b972fb44d99e6e834abf8068c3c419c7f174b4ca29075dc5d03ab186a8fb5fdf3ff2d4e4ba8679db8f5f493761ebfd4d89f3192f009dcf262aae86
7
- data.tar.gz: a2862dcbb7c98960b115afa053b9585e0094489e531ca6daebbf0ce961b36e4f933170ba0ed42329c3cf779e6bcafd00436e765380bfc87a47579564d6001f48
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.empty?
632
- language = m[2].strip.split(/ /)[0]
633
- code_block = pad_max(m[3].to_s, '')
634
- leader = language || 'code'
635
- else
636
- first_line = m[3].to_s.split(/\n/)[0]
637
-
638
- if first_line =~ %r{^\s*#!.*/.+}
639
- shebang = first_line.match(%r{^\s*#!.*/(?:env )?([^/]+)$})
640
- language = shebang[1]
641
- code_block = m[3]
642
- leader = shebang[1] || 'code'
643
- else
644
- code_block = pad_max(m[3].to_s, "#{color('code_block eol')}¬")
645
- leader = 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.35'
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.35
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-08-20 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