vimwiki_markdown 0.7.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/changelog.md +14 -0
- data/lib/vimwiki_markdown/version.rb +1 -1
- data/lib/vimwiki_markdown/vimwiki_toc_filter.rb +32 -0
- data/lib/vimwiki_markdown/wiki_body.rb +2 -1
- data/vimwiki_markdown.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df82303f4e7c42a37b10f251dc47ff99f7f8bdb47213320647ec9e287b18e349
|
4
|
+
data.tar.gz: 87779ad8e73e817a491a4b02d5dfdee31c0486c6c53a71a3f7777f8eea039326
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae0332624f846dd12436ea09f2c01b57a1f3828161304cd422dbbb5525fadacdf3c3681675901478ee92a06566cff7fdbb946e7dee68e64fbe053cf67a055cdf
|
7
|
+
data.tar.gz: 39d46583937bcea223d642b8432ea555de284d8e4e0f623ab38681f39cd66fce12982cdcb526591aaccf547bdf88c9f2fefc11e0d19910fe986fb59f9e5ba456
|
data/changelog.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## 0.8.1 [March 7 2022]
|
2
|
+
Update commonmarker version, fixes security issue!
|
3
|
+
|
4
|
+
## 0.8.0 [March 7 2022]
|
5
|
+
Fixes an issue where VimwikiTOC generated table of contents where there are duplicate heading names did not match the output HTML from the Github pipeline.
|
6
|
+
|
7
|
+
This means any generated (dupliate) bookmarks are going to be broken though, so, this is backwardly incompatible
|
8
|
+
|
9
|
+
see https://github.com/patrickdavey/vimwiki_markdown/pull/39
|
10
|
+
|
11
|
+
## 0.7.0 [July 8 2021]
|
12
|
+
Fixes an issue whereby non english filenames were being replaced with empty strings
|
13
|
+
see https://github.com/patrickdavey/vimwiki_markdown/pull/35
|
14
|
+
|
1
15
|
## 0.6.0 [April 26 2020]
|
2
16
|
Support for todo lists with enhanced state options. Thanks to @primercuervo
|
3
17
|
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class VimwikiTOCFilter < HTML::Pipeline::TableOfContentsFilter
|
2
|
+
def call
|
3
|
+
result[:toc] = String.new('')
|
4
|
+
|
5
|
+
headers = Hash.new(1)
|
6
|
+
doc.css('h1, h2, h3, h4, h5, h6').each do |node|
|
7
|
+
text = node.text
|
8
|
+
id = ascii_downcase(text)
|
9
|
+
id.gsub!(PUNCTUATION_REGEXP, '') # remove punctuation
|
10
|
+
id.tr!(' ', '-') # replace spaces with dash
|
11
|
+
|
12
|
+
uniq = headers[id] > 1 ? "-#{headers[id]}" : ''
|
13
|
+
headers[id] += 1
|
14
|
+
if header_content = node.children.first
|
15
|
+
result[:toc] << %(<li><a href="##{id}#{uniq}">#{EscapeUtils.escape_html(text)}</a></li>\n)
|
16
|
+
header_content.add_previous_sibling(%(<a id="#{id}#{uniq}" class="anchor" href="##{id}#{uniq}" aria-hidden="true">#{anchor_icon}</a>))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
result[:toc] = %(<ul class="section-nav">\n#{result[:toc]}</ul>) unless result[:toc].empty?
|
20
|
+
doc
|
21
|
+
end
|
22
|
+
|
23
|
+
if RUBY_VERSION >= '2.4'
|
24
|
+
def ascii_downcase(str)
|
25
|
+
str.downcase(:ascii)
|
26
|
+
end
|
27
|
+
else
|
28
|
+
def ascii_downcase(str)
|
29
|
+
str.downcase
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -3,6 +3,7 @@ require 'github/markup'
|
|
3
3
|
require 'html/pipeline'
|
4
4
|
require 'pathname'
|
5
5
|
require "vimwiki_markdown/vimwiki_link"
|
6
|
+
require "vimwiki_markdown/vimwiki_toc_filter"
|
6
7
|
|
7
8
|
class VimwikiMarkdown::WikiBody
|
8
9
|
|
@@ -23,7 +24,7 @@ class VimwikiMarkdown::WikiBody
|
|
23
24
|
|
24
25
|
pipeline = HTML::Pipeline.new([
|
25
26
|
HTML::Pipeline::SyntaxHighlightFilter,
|
26
|
-
|
27
|
+
VimwikiTOCFilter
|
27
28
|
], { scope: "highlight"})
|
28
29
|
@result = pipeline.call(html)
|
29
30
|
@result = @result[:output].to_s
|
data/vimwiki_markdown.gemspec
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
|
30
30
|
spec.add_runtime_dependency "activesupport", "~> 4.1"
|
31
31
|
spec.add_runtime_dependency "github-markup", "~> 3.0"
|
32
|
-
spec.add_runtime_dependency "commonmarker", "~> 0.
|
32
|
+
spec.add_runtime_dependency "commonmarker", "~> 0.23.4"
|
33
33
|
spec.add_runtime_dependency "html-pipeline", "~> 2.0"
|
34
34
|
spec.add_runtime_dependency "rouge", "~> 3.3"
|
35
35
|
spec.add_runtime_dependency "escape_utils", "~> 1.2"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vimwiki_markdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Davey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -156,14 +156,14 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
159
|
+
version: 0.23.4
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
166
|
+
version: 0.23.4
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: html-pipeline
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -236,6 +236,7 @@ files:
|
|
236
236
|
- lib/vimwiki_markdown/template.rb
|
237
237
|
- lib/vimwiki_markdown/version.rb
|
238
238
|
- lib/vimwiki_markdown/vimwiki_link.rb
|
239
|
+
- lib/vimwiki_markdown/vimwiki_toc_filter.rb
|
239
240
|
- lib/vimwiki_markdown/wiki_body.rb
|
240
241
|
- spec/lib/vimwiki_markdown/options_spec.rb
|
241
242
|
- spec/lib/vimwiki_markdown/template_spec.rb
|