mato 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8fcbd9aeee5b4c9a0c3a8a101a876fcb403bae92926a0e2c5d9ca0a56295a37e
4
- data.tar.gz: 2ba4fbdb19c68bb02ed208b6787cb09c9992e31ebbbdd78c3e8f410007084bf1
3
+ metadata.gz: 625a6024f01153083c4c1c8022ce9532eca6fd3cb0cb8874693b00bb73839973
4
+ data.tar.gz: 6d725206598e8608c0a99d574d70010a37521bca21b9a4ca059ba3262ef20225
5
5
  SHA512:
6
- metadata.gz: 399ce3de0b8f7e4436c12f8275e40623fb7551ffec521a294d7a807b3d6f2756718bb7cdcf8fb145bd345a50c5c5769bf985d55170596b79fed8a48bca56f29d
7
- data.tar.gz: 59208ddcb81a19f1cb356715cda80fabdc30e1476c728ac3b8f3ed2ba219b179a1e6a0e21b109f162294fb16231a34bef36034b4be120bcf0a2ce316ef180a9e
6
+ metadata.gz: 5106e5dc5ee1c5a96edfaaace1d1586c492241993ee06a78b3faa19495c9e827b4e7f355c14fae2bde43b3e8ba2113827a2bcb1c8195cd0e36ab94ec1bc312ef
7
+ data.tar.gz: 4880a986271175e6049c0e35e484f1f20918faaa745f977c37d59b08aa9cd2233e67212f2df5d199db8fba5f4c3876b988d70e38c41c614e2be6e803d84e9d66
@@ -11,13 +11,13 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
  strategy:
13
13
  matrix:
14
- ruby-version: ["3.1", "3.2", "3.3"]
14
+ ruby-version: ["3.2", "3.3"]
15
15
  steps:
16
- - uses: actions/checkout@v3
17
- - name: Set up Ruby
18
- uses: ruby/setup-ruby@v1
19
- with:
20
- ruby-version: ${{ matrix.ruby-version }}
21
- bundler-cache: true # runs 'bundle install' and caches installed gems automatically
22
- - name: Run tests
23
- run: bundle exec rake test
16
+ - uses: actions/checkout@v3
17
+ - name: Set up Ruby
18
+ uses: ruby/setup-ruby@v1
19
+ with:
20
+ ruby-version: ${{ matrix.ruby-version }}
21
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
22
+ - name: Run tests
23
+ run: bundle exec rake test
data/.rubocop.yml CHANGED
@@ -3,7 +3,7 @@ require:
3
3
  - rubocop-performance
4
4
 
5
5
  AllCops:
6
- TargetRubyVersion: 3.1
6
+ TargetRubyVersion: 3.2
7
7
  DisplayCopNames: true
8
8
  Exclude:
9
9
  - bin/**/*
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # The revision history of Mato
2
2
 
3
+ ## v2.6.0 - 2024/05/07
4
+
5
+ https://github.com/bitjourney/mato/compare/v2.5.0...v2.6.0
6
+
7
+ * Bump up commonmarker to 2.3
8
+
3
9
  ## v2.5.0 - 2024/05/07
4
10
 
5
11
  https://github.com/bitjourney/mato/compare/v2.4.0...v2.5.0
data/lib/mato/config.rb CHANGED
@@ -10,6 +10,7 @@ module Mato
10
10
  render: {
11
11
  hardbreaks: true,
12
12
  unsafe: true,
13
+ escaped_char_spans: false,
13
14
  },
14
15
  extension: {
15
16
  table: true,
@@ -43,6 +44,9 @@ module Mato
43
44
  # @return [Hash] Commonmarker's options
44
45
  attr_accessor :markdown_options
45
46
 
47
+ # @return [Hash] Commonmarker's plugins
48
+ attr_accessor :markdown_plugins
49
+
46
50
  def initialize
47
51
  @text_filters = []
48
52
  @markdown_filters = []
@@ -54,6 +58,7 @@ module Mato
54
58
  @document_factory = Document
55
59
 
56
60
  @markdown_options = DEFAULT_MARKDOWN_OPTIONS
61
+ @markdown_plugins = { syntax_highlighter: nil }
57
62
  end
58
63
 
59
64
  # @param [Proc] block
@@ -17,6 +17,8 @@ module Mato
17
17
  anchor_builder = AnchorBuilder.new(@anchor_icon_element)
18
18
 
19
19
  doc.css(HX_PATTERN).each do |hx|
20
+ # Remove existing anchor elements generated by CommonMarker v2
21
+ hx.css('a.anchor[inert]').remove
20
22
  hx.children = anchor_builder.make_anchor_element(hx) + hx.children.to_html
21
23
  end
22
24
  end
@@ -56,7 +56,8 @@ module Mato
56
56
  # @return [Nokogiri::XML::Element] a new <div/> wrapping the given code block
57
57
  def highlight(pre)
58
58
  code = pre.at('code')
59
- metadata = parse_label(code['class'])
59
+ lang_attr = pre['lang'] || code['class']
60
+ metadata = parse_label(lang_attr)
60
61
  language = metadata[:language]&.sub(/^language-/, '')
61
62
  filename = metadata[:filename]
62
63
  source = code.inner_text
@@ -51,7 +51,7 @@ module Mato
51
51
  # @param [Commonmarker::Node] markdown_node
52
52
  # @return [String]
53
53
  def render_to_html(markdown_node)
54
- markdown_node.to_html(options: config.markdown_options)
54
+ markdown_node.to_html(options: config.markdown_options, plugins: config.markdown_plugins)
55
55
  end
56
56
 
57
57
  # @param [String] html
data/lib/mato/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mato
4
- VERSION = "2.5.0"
4
+ VERSION = "2.6.0"
5
5
  end
data/mato.gemspec CHANGED
@@ -25,9 +25,9 @@ Gem::Specification.new do |spec|
25
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
26
  spec.require_paths = ["lib"]
27
27
 
28
- spec.required_ruby_version = "~> 3.1"
28
+ spec.required_ruby_version = "~> 3.2"
29
29
 
30
- spec.add_runtime_dependency "commonmarker", "~> 1.0"
30
+ spec.add_runtime_dependency "commonmarker", "~> 2.3"
31
31
  spec.add_runtime_dependency "nokogiri", ">= 1.12"
32
32
  spec.add_runtime_dependency "rouge", ">= 3.0.0"
33
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mato
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - FUJI Goro
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-07 00:00:00.000000000 Z
11
+ date: 2025-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commonmarker
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '2.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '2.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: nokogiri
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -107,14 +107,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '3.1'
110
+ version: '3.2'
111
111
  required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  requirements:
113
113
  - - ">="
114
114
  - !ruby/object:Gem::Version
115
115
  version: '0'
116
116
  requirements: []
117
- rubygems_version: 3.3.26
117
+ rubygems_version: 3.4.19
118
118
  signing_key:
119
119
  specification_version: 4
120
120
  summary: MArkdown TOolkit