jekyll-spaceship 0.8.1 → 0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +62 -1
- data/lib/jekyll-spaceship/cores/processor.rb +9 -5
- data/lib/jekyll-spaceship/processors/element-processor.rb +71 -53
- data/lib/jekyll-spaceship/processors/emoji-processor.rb +3 -2
- data/lib/jekyll-spaceship/processors/table-processor.rb +85 -12
- data/lib/jekyll-spaceship/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f3d45fd1335dcec7d9c05900219920869adaa418fd72b29b3fde3fcdfafc14d
|
4
|
+
data.tar.gz: 2e1fc457586b11bfa8d9fc215ba6c870a3f09ea85a78872d72a8692eeb12abcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c2b6900e10b029dbedad643eeb19c4d7a8332003e0bf8079af7c792bef622bc04ff550194e82d1dde365fd54fcd3f4f3997e25c357fac149db1f7eaca6cb414
|
7
|
+
data.tar.gz: 9a3b141d78a7d22aceea2e7ca8545c44a070303e4241db7f56adc301917d34bc91ff6dfb5e09df7dbf8a1739cb6c2f4a1c36c5f73fbc1a9884667350789c9bba
|
data/README.md
CHANGED
@@ -101,6 +101,7 @@ Spaceship is a minimalistic, powerful and extremely customizable [Jekyll](https:
|
|
101
101
|
- [1.3 Headerless](#headerless)
|
102
102
|
- [1.4 Cell Alignment](#cell-alignment)
|
103
103
|
- [1.5 Cell Markdown](#cell-markdown)
|
104
|
+
- [1.6 Cell Inline Attributes](#cell-inline-attributes)
|
104
105
|
- [2. MathJax Usage](#2-mathjax-usage)
|
105
106
|
- [2.1 Performance Optimization](#21-performance-optimization)
|
106
107
|
- [2.2 How to use?](#22-how-to-use)
|
@@ -140,7 +141,12 @@ plugins:
|
|
140
141
|
- jekyll-spaceship
|
141
142
|
```
|
142
143
|
|
143
|
-
**💡 Tip:** Note that GitHub Pages runs in `safe` mode and only allows [a set of whitelisted plugins](https://pages.github.com/versions/). To use the gem in GitHub Pages, you need to build locally or use CI (e.g. [travis](https://travis-ci.org/), [github workflow](https://help.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow)) and deploy to your `gh-pages` branch.
|
144
|
+
**💡 Tip:** Note that GitHub Pages runs in `safe` mode and only allows [a set of whitelisted plugins](https://pages.github.com/versions/). To use the gem in GitHub Pages, you need to build locally or use CI (e.g. [travis](https://travis-ci.org/), [github workflow](https://help.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow)) and deploy to your `gh-pages` branch.
|
145
|
+
|
146
|
+
### Additions
|
147
|
+
|
148
|
+
* Here is a GitHub Action named [jekyll-deploy-action](https://github.com/jeffreytse/jekyll-deploy-action) for Jekyll site deployment conveniently. 👍
|
149
|
+
* Here is a [Jekyll site](https://github.com/jeffreytse/jekyll-jeffreytse-blog) using Travis to build and deploy to GitHub Pages for your references.
|
144
150
|
|
145
151
|
## Configuration
|
146
152
|
|
@@ -529,6 +535,61 @@ Rowspan is 4
|
|
529
535
|
</tbody>
|
530
536
|
</table>
|
531
537
|
|
538
|
+
#### Cell Inline Attributes
|
539
|
+
|
540
|
+
This feature is very useful for custom cell such as using inline style. (e.g., background, color, font)
|
541
|
+
The idea and syntax comes from the [Maruku](http://maruku.rubyforge.org/) package.
|
542
|
+
|
543
|
+
[](https://kramdown.gettalong.org/syntax.html#block-ials)
|
544
|
+
|
545
|
+
Following are some examples of attributes definitions (ALDs) and afterwards comes the syntax explanation:
|
546
|
+
|
547
|
+
```markdown
|
548
|
+
{:ref-name: #id .cls1 .cls2}
|
549
|
+
{:second: ref-name #id-of-other title="hallo you"}
|
550
|
+
{:other: ref-name second}
|
551
|
+
```
|
552
|
+
|
553
|
+
An ALD line has the following structure:
|
554
|
+
|
555
|
+
- a left brace, optionally preceded by up to three spaces,
|
556
|
+
- followed by a colon, the id and another colon,
|
557
|
+
- followed by attribute definitions (allowed characters are backslash-escaped closing braces or any character except a not escaped closing brace),
|
558
|
+
- followed by a closing brace and optional spaces until the end of the line.
|
559
|
+
|
560
|
+
If there is more than one ALD with the same reference name, the attribute definitions of all the ALDs are processed like they are defined in one ALD.
|
561
|
+
|
562
|
+
An inline attribute list (IAL) is used to attach attributes to another element.
|
563
|
+
Here are some examples for span IALs:
|
564
|
+
|
565
|
+
```markdown
|
566
|
+
{: #id .cls1 .cls2} <!-- #id <=> id="id", .cls1 .cls2 <=> class="cls1 cls2" -->
|
567
|
+
{: ref-name title="hallo you"}
|
568
|
+
{: ref-name class='.cls3' .cls4}
|
569
|
+
```
|
570
|
+
|
571
|
+
Here is an example for custom table cell with IAL:
|
572
|
+
|
573
|
+
```markdown
|
574
|
+
{:color-style: style="background: black;" }
|
575
|
+
{:color-style: style="color: white;" }
|
576
|
+
{:font-style: style="font-weight: 800;" }
|
577
|
+
|
578
|
+
|: Here's an Inline Attribute Lists example :||||
|
579
|
+
| ------- | ------------------------- | -------------------- | ----------- |
|
580
|
+
|: :|: <div style="color: red;"> < Normal HTML Block > </div> :|||
|
581
|
+
| ^^ | Red {: .cls style="background: orange" } |||
|
582
|
+
| ^^ IALs | Green {: #id style="background: green; color: white" } |||
|
583
|
+
| ^^ | Blue {: style="background: blue; color: white" } |||
|
584
|
+
| ^^ | Black {: color-style font-weight} |||
|
585
|
+
```
|
586
|
+
|
587
|
+
Code above would be parsed as:
|
588
|
+
|
589
|
+
<img width="580px" src="https://user-images.githubusercontent.com/9413601/88461592-738afb00-ced7-11ea-9aac-3179023742b0.png" alt="IALs">
|
590
|
+
|
591
|
+
Additionally, [here](https://kramdown.gettalong.org/syntax.html#block-ials) you can learn more details about IALs.
|
592
|
+
|
532
593
|
### 2. MathJax Usage
|
533
594
|
|
534
595
|
[MathJax](http://www.mathjax.org/) is an open-source JavaScript display engine for LaTeX, MathML, and AsciiMath notation that works in all modern browsers.
|
@@ -65,7 +65,7 @@ module Jekyll::Spaceship
|
|
65
65
|
|
66
66
|
def initialize_exclusions
|
67
67
|
if @@_exclusions.size.zero?
|
68
|
-
self.class.exclude :code, :
|
68
|
+
self.class.exclude :code, :math, :liquid_filter
|
69
69
|
end
|
70
70
|
@exclusions = @@_exclusions.uniq
|
71
71
|
@@_exclusions.clear
|
@@ -121,7 +121,7 @@ module Jekyll::Spaceship
|
|
121
121
|
else
|
122
122
|
if Type.html? output_ext
|
123
123
|
method = 'on_handle_html'
|
124
|
-
elsif css? output_ext
|
124
|
+
elsif Type.css? output_ext
|
125
125
|
method = 'on_handle_css'
|
126
126
|
end
|
127
127
|
if self.respond_to? method
|
@@ -156,13 +156,17 @@ module Jekyll::Spaceship
|
|
156
156
|
@exclusions.each do |type|
|
157
157
|
regex = nil
|
158
158
|
if type == :code
|
159
|
-
regex = /((`+)\s*(\w*)((?:.|\n)*?)\2)/
|
159
|
+
regex = /(((?<!\\)`+)\s*(\w*)((?:.|\n)*?)\2)/
|
160
|
+
elsif type == :math
|
161
|
+
regex = /(((?<!\\)\${1,2})[^\n]*?\1)/
|
162
|
+
elsif type == :liquid_filter
|
163
|
+
regex = /((?<!\\)\{\{[^\n]*?\}\})/
|
160
164
|
end
|
161
165
|
next if regex.nil?
|
162
166
|
content.scan(regex) do |match_data|
|
163
167
|
match = match_data[0]
|
164
168
|
id = @exclusion_store.size
|
165
|
-
content = content.sub(match, "
|
169
|
+
content = content.sub(match, "<!JEKYLL@#{object_id}@#{id}>")
|
166
170
|
@exclusion_store.push match
|
167
171
|
end
|
168
172
|
end
|
@@ -173,7 +177,7 @@ module Jekyll::Spaceship
|
|
173
177
|
while @exclusion_store.size > 0
|
174
178
|
match = @exclusion_store.pop
|
175
179
|
id = @exclusion_store.size
|
176
|
-
content = content.sub("
|
180
|
+
content = content.sub("<!JEKYLL@#{object_id}@#{id}>", match)
|
177
181
|
end
|
178
182
|
@exclusion_store = []
|
179
183
|
content
|
@@ -45,61 +45,11 @@ module Jekyll::Spaceship
|
|
45
45
|
if data.kind_of? String
|
46
46
|
element.replace Nokogiri::HTML.fragment(data)
|
47
47
|
elsif data.kind_of? Hash
|
48
|
-
|
49
|
-
element.name = data['name'] unless data['name'].nil?
|
50
|
-
|
51
|
-
# set props
|
52
|
-
data['props']&.each do |prop, val|
|
53
|
-
next element.remove_attribute if val.nil?
|
54
|
-
if val.kind_of? Array
|
55
|
-
next if val.size != 2
|
56
|
-
v = element[prop]
|
57
|
-
v = '' if v.nil?
|
58
|
-
val = v.sub(/#{val[0]}/, val[1])
|
59
|
-
elsif val.kind_of? Hash
|
60
|
-
result = []
|
61
|
-
val.each { |k, v| result.push "#{k}: #{v}" }
|
62
|
-
val = result.join(";")
|
63
|
-
end
|
64
|
-
element.set_attribute(prop, val)
|
65
|
-
end
|
66
|
-
|
67
|
-
# processing children
|
68
|
-
return unless data.has_key?('children')
|
69
|
-
return element.inner_html = "" if data['children'].nil?
|
70
|
-
children = self.create_children({
|
48
|
+
handle_hash_element({
|
71
49
|
:doc => doc,
|
72
|
-
:
|
50
|
+
:element => element,
|
51
|
+
:data => data,
|
73
52
|
})
|
74
|
-
|
75
|
-
# replace whole inner html
|
76
|
-
unless data['children'].kind_of? Array
|
77
|
-
return element.inner_html = children
|
78
|
-
end
|
79
|
-
|
80
|
-
if element.children.size.zero?
|
81
|
-
return element.inner_html = children
|
82
|
-
end
|
83
|
-
|
84
|
-
index = data['children'].index(nil)
|
85
|
-
if index.nil?
|
86
|
-
return element.inner_html = children
|
87
|
-
end
|
88
|
-
|
89
|
-
# insert to the end of children
|
90
|
-
if index == 0
|
91
|
-
return element.children.last.after(children)
|
92
|
-
end
|
93
|
-
|
94
|
-
# insert to the begin of children
|
95
|
-
rindex = data['children'].rindex { |item| !item.nil? }
|
96
|
-
if index == rindex + 1
|
97
|
-
return element.children.first.before children
|
98
|
-
end
|
99
|
-
|
100
|
-
# wrap the children
|
101
|
-
element.children.first.before children[0..index]
|
102
|
-
element.children.last.after children[index..children.size]
|
103
53
|
end
|
104
54
|
end
|
105
55
|
|
@@ -126,6 +76,45 @@ module Jekyll::Spaceship
|
|
126
76
|
root.children
|
127
77
|
end
|
128
78
|
|
79
|
+
def handle_hash_element(data)
|
80
|
+
doc = data[:doc]
|
81
|
+
element = data[:element]
|
82
|
+
data = data[:data]
|
83
|
+
|
84
|
+
# set name
|
85
|
+
element.name = data['name'] unless data['name'].nil?
|
86
|
+
|
87
|
+
# set props
|
88
|
+
data['props']&.each do |prop, val|
|
89
|
+
next element.remove_attribute if val.nil?
|
90
|
+
if val.kind_of? Array
|
91
|
+
next if val.size != 2
|
92
|
+
v = element[prop]
|
93
|
+
v = '' if v.nil?
|
94
|
+
val = v.sub(/#{val[0]}/, val[1])
|
95
|
+
elsif val.kind_of? Hash
|
96
|
+
result = []
|
97
|
+
val.each { |k, v| result.push "#{k}: #{v}" }
|
98
|
+
val = result.join(";")
|
99
|
+
end
|
100
|
+
element.set_attribute(prop, val)
|
101
|
+
end
|
102
|
+
|
103
|
+
# processing children
|
104
|
+
return unless data.has_key?('children')
|
105
|
+
return element.inner_html = "" if data['children'].nil?
|
106
|
+
children = self.create_children({
|
107
|
+
:doc => doc,
|
108
|
+
:data => data['children']
|
109
|
+
})
|
110
|
+
|
111
|
+
handle_element_placement({
|
112
|
+
:data => data,
|
113
|
+
:element => element,
|
114
|
+
:children => children,
|
115
|
+
})
|
116
|
+
end
|
117
|
+
|
129
118
|
def create_element(data)
|
130
119
|
doc = data[:doc]
|
131
120
|
data = data[:data]
|
@@ -148,5 +137,34 @@ module Jekyll::Spaceship
|
|
148
137
|
end
|
149
138
|
node
|
150
139
|
end
|
140
|
+
|
141
|
+
def handle_element_placement(data)
|
142
|
+
element = data[:element]
|
143
|
+
children = data[:children]
|
144
|
+
data = data[:data]
|
145
|
+
|
146
|
+
# replace whole inner html
|
147
|
+
unless data['children'].kind_of? Array
|
148
|
+
return element.inner_html = children
|
149
|
+
end
|
150
|
+
|
151
|
+
if element.children.size.zero?
|
152
|
+
return element.inner_html = children
|
153
|
+
end
|
154
|
+
|
155
|
+
index = data['children'].index(nil)
|
156
|
+
rindex = data['children'].rindex { |item| !item.nil? }
|
157
|
+
|
158
|
+
if index.nil?
|
159
|
+
element.inner_html = children
|
160
|
+
elsif index == 0 # insert to the end of children
|
161
|
+
element.children.last.after(children)
|
162
|
+
elsif index == rindex + 1 # insert to the begin of children
|
163
|
+
element.children.first.before children
|
164
|
+
else # wrap the children
|
165
|
+
element.children.first.before children[0..index]
|
166
|
+
element.children.last.after children[index..children.size]
|
167
|
+
end
|
168
|
+
end
|
151
169
|
end
|
152
170
|
end
|
@@ -24,15 +24,16 @@ module Jekyll::Spaceship
|
|
24
24
|
|
25
25
|
# escape plus sign
|
26
26
|
emoji_name = emoji.name.gsub('+', '\\\+')
|
27
|
+
css_class = self.config['css']['class']
|
27
28
|
|
28
29
|
content = content.gsub(
|
29
30
|
/(?<!\=")\s*:#{emoji_name}:\s*(?!"\s)/,
|
30
|
-
"<img class=\"\""\
|
31
|
+
"<img class=\"#{css_class}\""\
|
31
32
|
" title=\":#{emoji.name}:\""\
|
32
33
|
" alt=\":#{emoji.name}:\""\
|
33
34
|
" raw=\"#{emoji.raw}\""\
|
34
35
|
" src=\"#{config['src']}#{emoji.image_filename}\""\
|
35
|
-
" style=\"vertical-align: middle;"\
|
36
|
+
" style=\"vertical-align: middle; display: inline;"\
|
36
37
|
" max-width: 1em; visibility: hidden;\""\
|
37
38
|
" onload=\"this.style.visibility='visible'\""\
|
38
39
|
" onerror=\"this.replaceWith(this.getAttribute('raw'))\">"\
|
@@ -5,18 +5,21 @@ require "nokogiri"
|
|
5
5
|
|
6
6
|
module Jekyll::Spaceship
|
7
7
|
class TableProcessor < Processor
|
8
|
+
ATTR_LIST_PATTERN = /((?<!\\)\{:(?:([A-Za-z]\S*):)?(.*?)(?<!\\)\})/
|
9
|
+
ATTR_LIST_REFS = {}
|
10
|
+
|
8
11
|
def on_handle_markdown(content)
|
9
12
|
# pre-handle reference-style links
|
10
13
|
references = {}
|
11
|
-
content.scan(
|
14
|
+
content.scan(/\n\s*(\[(.*)\]:\s*(\S+(\s+".*?")?))/) do |match_data|
|
12
15
|
ref_name = match_data[1]
|
13
16
|
ref_value = match_data[2]
|
14
17
|
references[ref_name] = ref_value
|
15
18
|
end
|
16
19
|
if references.size > 0
|
17
|
-
content.scan(
|
20
|
+
content.scan(/[^\n]*(?<!\\)\|[^\n]*/) do |result|
|
18
21
|
references.each do |key, val|
|
19
|
-
replace = result.gsub(/\[(
|
22
|
+
replace = result.gsub(/\[([^\n]*)\]\s*\[#{key}\]/, "[\1](#{val})")
|
20
23
|
next if result == replace
|
21
24
|
content = content.gsub(result, replace)
|
22
25
|
end
|
@@ -24,21 +27,37 @@ module Jekyll::Spaceship
|
|
24
27
|
end
|
25
28
|
|
26
29
|
# pre-handle row-span
|
27
|
-
content = content.gsub(/(?<!\\)(
|
30
|
+
content = content.gsub(/(?<!\\)(\|[^\n]*\\\s*)\|\s*\n/, "\\1\n")
|
28
31
|
|
29
32
|
# escape | and :
|
30
33
|
content = content.gsub(/\|(?=\|)/, '\\|')
|
31
|
-
.gsub(/\\:(
|
32
|
-
.gsub(/((?<!\\)
|
34
|
+
.gsub(/\\:(?=[^\n]*?(?<!\\)\|)/, '\\\\\\\\:')
|
35
|
+
.gsub(/((?<!\\)\|[^\n]*?)(\\:)/, '\1\\\\\\\\:')
|
33
36
|
|
34
37
|
# escape * and _ and $ etc.
|
35
|
-
content.scan(
|
38
|
+
content.scan(/[^\n]*(?<!\\)\|[^\n]*/) do |result|
|
39
|
+
# skip for math expression within pipeline
|
40
|
+
next unless result
|
41
|
+
.gsub(/((?<!\\)\${1,2})[^\n]*?\1/, '')
|
42
|
+
.match(/(?<!\\)\|/)
|
36
43
|
replace = result.gsub(
|
37
|
-
/(?<!(?<!\\)\\)(\*|\$|\[|\(|\"|_)/,
|
38
|
-
'\\\\\\\\\1')
|
44
|
+
/(?<!(?<!\\)\\)(\*|\$|\[|\(|\"|_)/, '\\\\\\\\\1')
|
39
45
|
next if result == replace
|
40
46
|
content = content.gsub(result, replace)
|
41
47
|
end
|
48
|
+
|
49
|
+
# pre-handle attribute list (AL)
|
50
|
+
ATTR_LIST_REFS.clear()
|
51
|
+
content.scan(ATTR_LIST_PATTERN) do |result|
|
52
|
+
ref = result[1]
|
53
|
+
list = result[2]
|
54
|
+
next if ref.nil?
|
55
|
+
if ATTR_LIST_REFS.has_key? ref
|
56
|
+
ATTR_LIST_REFS[ref] += list
|
57
|
+
else
|
58
|
+
ATTR_LIST_REFS[ref] = list
|
59
|
+
end
|
60
|
+
end
|
42
61
|
content
|
43
62
|
end
|
44
63
|
|
@@ -50,6 +69,7 @@ module Jekyll::Spaceship
|
|
50
69
|
|
51
70
|
# handle each table
|
52
71
|
doc.css('table').each do |table|
|
72
|
+
next if table.ancestors('code, pre').size > 0
|
53
73
|
rows = table.css('tr')
|
54
74
|
data.table = table
|
55
75
|
data.rows = rows
|
@@ -65,6 +85,7 @@ module Jekyll::Spaceship
|
|
65
85
|
handle_multi_rows(data)
|
66
86
|
handle_text_align(data)
|
67
87
|
handle_rowspan(data)
|
88
|
+
handle_attr_list(data)
|
68
89
|
end
|
69
90
|
end
|
70
91
|
rows.each do |row|
|
@@ -157,7 +178,7 @@ module Jekyll::Spaceship
|
|
157
178
|
if scope.table.multi_row_cells != cells and scope.table.multi_row_start
|
158
179
|
for i in 0...scope.table.multi_row_cells.count do
|
159
180
|
multi_row_cell = scope.table.multi_row_cells[i]
|
160
|
-
multi_row_cell.inner_html += "<br
|
181
|
+
multi_row_cell.inner_html += "\n<br>\n#{cells[i].inner_html}"
|
161
182
|
end
|
162
183
|
row.remove
|
163
184
|
end
|
@@ -182,7 +203,7 @@ module Jekyll::Spaceship
|
|
182
203
|
span_cell = scope.table.span_row_cells[scope.row.col_index]
|
183
204
|
if span_cell and cell.content.match(/^\s*\^{2}/)
|
184
205
|
cell.content = cell.content.gsub(/^\s*\^{2}/, '')
|
185
|
-
span_cell.inner_html += "<br
|
206
|
+
span_cell.inner_html += "\n<br>\n#{cell.inner_html}"
|
186
207
|
rowspan = span_cell.get_attribute('rowspan') || 1
|
187
208
|
rowspan = rowspan.to_i + 1
|
188
209
|
span_cell.set_attribute('rowspan', "#{rowspan}")
|
@@ -231,6 +252,52 @@ module Jekyll::Spaceship
|
|
231
252
|
cell.set_attribute('style', style)
|
232
253
|
end
|
233
254
|
|
255
|
+
# Examples:
|
256
|
+
# {:ref-name: .cls1 title="hello" }
|
257
|
+
# {: #id ref-name data="world" }
|
258
|
+
# {: #id title="hello" }
|
259
|
+
# {: .cls style="color: #333" }
|
260
|
+
def handle_attr_list(data)
|
261
|
+
cell = data.cell
|
262
|
+
content = cell.inner_html
|
263
|
+
# inline attribute list(IAL) handler
|
264
|
+
ial_handler = ->(list) do
|
265
|
+
list.scan(/(\S+)=("|')(.*?)\2|(\S+)/) do |attr|
|
266
|
+
key = attr[0]
|
267
|
+
val = attr[2]
|
268
|
+
single = attr[3]
|
269
|
+
if !key.nil?
|
270
|
+
val = (cell.get_attribute(key) || '') + val
|
271
|
+
cell.set_attribute(key, val)
|
272
|
+
elsif !single.nil?
|
273
|
+
if single.start_with? '#'
|
274
|
+
key = 'id'
|
275
|
+
val = single[1..-1]
|
276
|
+
elsif single.start_with? '.'
|
277
|
+
key = 'class'
|
278
|
+
val = cell.get_attribute(key) || ''
|
279
|
+
val += (val.size.zero? ? '' : ' ') + single[1..-1]
|
280
|
+
elsif ATTR_LIST_REFS.has_key? single
|
281
|
+
ial_handler.call ATTR_LIST_REFS[single]
|
282
|
+
end
|
283
|
+
unless key.nil?
|
284
|
+
cell.set_attribute(key, val)
|
285
|
+
end
|
286
|
+
end
|
287
|
+
end
|
288
|
+
end
|
289
|
+
# handle attribute list
|
290
|
+
content.scan(ATTR_LIST_PATTERN) do |result|
|
291
|
+
ref = result[1]
|
292
|
+
list = result[2]
|
293
|
+
# handle inline attribute list
|
294
|
+
ial_handler.call list if ref.nil?
|
295
|
+
# remove attr_list
|
296
|
+
content = content.sub(result[0], '')
|
297
|
+
end
|
298
|
+
cell.inner_html = content
|
299
|
+
end
|
300
|
+
|
234
301
|
def handle_format(data)
|
235
302
|
cell = data.cell
|
236
303
|
cvter = self.converter('markdown')
|
@@ -238,8 +305,14 @@ module Jekyll::Spaceship
|
|
238
305
|
content = cell.inner_html
|
239
306
|
.gsub(/(?<!\\)\|/, '\\|')
|
240
307
|
.gsub(/^\s+|\s+$/, '')
|
308
|
+
.gsub(/</, '<')
|
309
|
+
.gsub(/>/, '>')
|
241
310
|
content = cvter.convert(content)
|
242
|
-
|
311
|
+
content = Nokogiri::HTML.fragment(content)
|
312
|
+
if content.children.first&.name == 'p'
|
313
|
+
content = content.children
|
314
|
+
end
|
315
|
+
cell.inner_html = content.inner_html
|
243
316
|
end
|
244
317
|
end
|
245
318
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-spaceship
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jeffreytse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -169,8 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
169
|
- !ruby/object:Gem::Version
|
170
170
|
version: '0'
|
171
171
|
requirements: []
|
172
|
-
|
173
|
-
rubygems_version: 2.7.7
|
172
|
+
rubygems_version: 3.0.8
|
174
173
|
signing_key:
|
175
174
|
specification_version: 4
|
176
175
|
summary: A Jekyll plugin to provide powerful supports for table, mathjax, plantuml,
|