vimwiki_markdown 0.4.0 → 0.4.1

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: d897f72d7a0477abd0949c827322a0eb03fdef2e25ef49a81924b553aa9b0735
4
- data.tar.gz: a78cb0793eda1cd773a139022bfca5aa1ba60e97f918a3887f76069d5c1c15d7
3
+ metadata.gz: a2fd707b900cb57f83d9b363ca7ecdfb1ef7bc3c0784b6d837d025506bfb23c9
4
+ data.tar.gz: 0ab730e8add13342a0d1188d281185c80ec23dbd2b4f7a88fd37953c665b2eab
5
5
  SHA512:
6
- metadata.gz: 312339f34d280767d0e34be1ceb4590f1545802145b70b4c4724b9550242e0f36a54021071c1dbc7bfe6c26aba3800c327fe909e4469c7ed75fb0d69fcec80b6
7
- data.tar.gz: fd739c1f256ef9ed1997de16f36ec03a77ea1c37e11aced19f9ec0c34b2996b6e72d1de88126c0cb133e5057b75a548ca7a83f860f35f729b148b456a15d7eb0
6
+ metadata.gz: 0e4bd0e9039a5dd14a1183eba6d1fab3bdf6d184bed9838be0da24be1ccd369c48f00d40fa35085f6355baf259907a1842ed8bfb242ff79152be91f955360615
7
+ data.tar.gz: 1efbc7939774eaca7b8d6b731a252cf2248da1f9bad622b3c74c567f35eea2572070e006b75d449fe005fefb6b48b1b52593ec8742ad3e60ae57e3b4aa7b1e08
data/changelog.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.4.1 [June 16 2019]
2
+ Allow "unsafe" HTML tags in markdown content (iframe etc.)
3
+
1
4
  ## 0.4.0 [June 16 2019]
2
5
  Support HTML tags in markdown content again.
3
6
 
@@ -1,3 +1,3 @@
1
1
  module VimwikiMarkdown
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
@@ -11,6 +11,8 @@ class VimwikiMarkdown::WikiBody
11
11
  end
12
12
 
13
13
  def to_s
14
+ hack_replace_commonmarker_proc!
15
+
14
16
  @markdown_body = get_wiki_markdown_contents
15
17
  fixlinks
16
18
  html = GitHub::Markup.render_s(
@@ -64,4 +66,12 @@ class VimwikiMarkdown::WikiBody
64
66
  VimwikiMarkdown::VimwikiLink.new(match, options.input_file, options.extension, options.root_path).to_s
65
67
  end
66
68
  end
69
+
70
+ def hack_replace_commonmarker_proc!
71
+ GitHub::Markup::Markdown::MARKDOWN_GEMS["commonmarker"] = proc { |content, options: {}|
72
+ commonmarker_opts = [:GITHUB_PRE_LANG].concat(options.fetch(:commonmarker_opts, []))
73
+ commonmarker_exts = options.fetch(:commonmarker_exts, [:autolink, :table, :strikethrough])
74
+ CommonMarker.render_html(content, commonmarker_opts, commonmarker_exts)
75
+ }
76
+ end
67
77
  end
@@ -39,6 +39,12 @@ module VimwikiMarkdown
39
39
  expect(wiki_body.to_s).to include("<p>hello world</p>")
40
40
  end
41
41
 
42
+ it "must convert unsafe html content correctly" do
43
+ allow_any_instance_of(VimwikiMarkdown::VimwikiLink).to receive(:vimwiki_markdown_file_exists?).and_return(true)
44
+ allow(wiki_body).to receive(:get_wiki_markdown_contents).and_return('<iframe src="test"></iframe>')
45
+ expect(wiki_body.to_s).to include('<iframe src="test"></iframe>')
46
+ end
47
+
42
48
  it "must convert multiple links on the same line correctly" do
43
49
  allow(wiki_body).to receive(:get_wiki_markdown_contents).and_return("[here](here) [there](there)")
44
50
  allow_any_instance_of(VimwikiMarkdown::VimwikiLink).to receive(:vimwiki_markdown_file_exists?).and_return(true)
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.0
4
+ version: 0.4.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: 2019-06-16 00:00:00.000000000 Z
11
+ date: 2019-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler