thredded-markdown_katex 0.2.0 → 0.3.0
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
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 21a7c92e13f578a469ac74e789a5d5dfa11ad69969049a418b5570f33e7618c3
|
4
|
+
data.tar.gz: 794c513519dbf70f68a219c785a6bceadf460f8e69751b4a4331acfdfa792461
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89b6cf98ec81b8eeac25fcc92f5c45d35b19e6d7969db5cf7628c7220f248a85ebaf7703789a1e00be57c6e92abddaab650b53731a4f3a42708a132540b6e252
|
7
|
+
data.tar.gz: 00e742742c0be5ee20a79733b645ab16e40d031bb5e2e6af6182c8ae9b63c4453929a138fc45ea6028f8fcce4d98f1186d20f24a75ab49726dc531742f8c5ee6
|
@@ -22,7 +22,10 @@ module Thredded
|
|
22
22
|
|
23
23
|
def setup! # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
24
24
|
if pipeline_contains?(KRAMDOWN_FILTER_CLASS_NAME)
|
25
|
-
|
25
|
+
# KaTeX engine for versions of Kramdown that do not have it built-in:
|
26
|
+
if Gem::Version.new(Kramdown::VERSION) < Gem::Version.new('1.17.0')
|
27
|
+
require 'thredded/markdown_katex/kramdown/katex_converter'
|
28
|
+
end
|
26
29
|
Thredded::HtmlPipeline::KramdownFilter.options.update(options)
|
27
30
|
else
|
28
31
|
raise "#{self.class.name} requires #{KRAMDOWN_FILTER_CLASS_NAME} " \
|
@@ -1,25 +1,36 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# KaTeX support for Kramdown < v1.17.0 (newer versions have built-in support).
|
4
|
+
|
3
5
|
module Thredded
|
4
6
|
module MarkdownKatex
|
5
7
|
module Kramdown
|
6
8
|
# The KaTeX converter engine for Kramdown.
|
7
9
|
module KatexConverter
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
# rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
11
|
+
|
12
|
+
def self.call(converter, el, opts)
|
13
|
+
display_mode = el.options[:category] == :block
|
14
|
+
result = ::Katex.render(
|
15
|
+
el.value,
|
16
|
+
display_mode: display_mode,
|
17
|
+
throw_on_error: false,
|
18
|
+
**converter.options[:math_engine_opts]
|
12
19
|
)
|
20
|
+
attr = el.attr.dup
|
21
|
+
attr.delete('xmlns')
|
22
|
+
attr.delete('display')
|
23
|
+
result
|
24
|
+
.insert(result =~ /[[:space:]>]/, converter.html_attributes(attr))
|
25
|
+
result = "#{' ' * opts[:indent]}#{result}\n" if display_mode
|
26
|
+
result
|
13
27
|
end
|
28
|
+
# rubocop:enable Metrics/AbcSize,Metrics/MethodLength
|
14
29
|
end
|
15
30
|
end
|
16
31
|
end
|
17
32
|
end
|
18
33
|
|
19
34
|
require 'kramdown/converter'
|
20
|
-
Kramdown::Converter
|
21
|
-
add_math_engine
|
22
|
-
add_math_engine(:katex, ::Thredded::MarkdownKatex::Kramdown::KatexConverter)
|
23
|
-
math_engine(:katex).call(converter, el, opts)
|
24
|
-
end
|
25
|
-
end
|
35
|
+
Kramdown::Converter
|
36
|
+
.add_math_engine(:katex, ::Thredded::MarkdownKatex::Kramdown::KatexConverter)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thredded-markdown_katex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gleb Mazovetskiy
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: katex
|
@@ -16,28 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.4.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: 0.
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: thredded
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.11.0
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 0.11.0
|
26
|
+
version: 0.4.3
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: bundler
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +94,20 @@ dependencies:
|
|
108
94
|
- - ">="
|
109
95
|
- !ruby/object:Gem::Version
|
110
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: thredded
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.11.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.11.0
|
111
111
|
description: Adds TeX math support to Thredded markup via KaTeX.
|
112
112
|
email:
|
113
113
|
- glex.spb@gmail.com
|
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
146
|
version: '0'
|
147
147
|
requirements: []
|
148
148
|
rubyforge_project:
|
149
|
-
rubygems_version: 2.6
|
149
|
+
rubygems_version: 2.7.6
|
150
150
|
signing_key:
|
151
151
|
specification_version: 4
|
152
152
|
summary: Adds TeX math support to Thredded markup via KaTeX.
|