markitdown 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/markitdown.rb +4 -1
- data/lib/markitdown/version.rb +1 -1
- data/spec/doc.markdown +8 -6
- data/spec/tag_spec.rb +8 -0
- metadata +4 -4
data/README.md
CHANGED
@@ -12,7 +12,7 @@ Markitdown is a Ruby library that converts HTML to Markdown. It's powered by Nok
|
|
12
12
|
* Definition lists
|
13
13
|
* Tables
|
14
14
|
* Underlines
|
15
|
-
* Strikethroughs (strike
|
15
|
+
* Strikethroughs (strike or del tags)
|
16
16
|
* Highlights (mark tag)
|
17
17
|
* Superscripts (sup tag)
|
18
18
|
|
data/lib/markitdown.rb
CHANGED
@@ -89,6 +89,9 @@ module Markitdown
|
|
89
89
|
when "strike"
|
90
90
|
results << " ~~"
|
91
91
|
after = "END_TAG(~~) "
|
92
|
+
when "del"
|
93
|
+
results << " ~~"
|
94
|
+
after = "END_TAG(~~) "
|
92
95
|
when "mark"
|
93
96
|
results << " =="
|
94
97
|
after = "END_TAG(==) "
|
@@ -138,7 +141,7 @@ module Markitdown
|
|
138
141
|
results << node.text.strip.gsub("\n","").gsub(/ {2,}/," ")
|
139
142
|
when "code"
|
140
143
|
if node.text.include?("\n")
|
141
|
-
results << "\n\n
|
144
|
+
results << "\n\n```\n#{node.text.gsub(/^\n/,"").gsub(/\n\s*$/,"")}\n```\n\n"
|
142
145
|
else
|
143
146
|
results << " `#{node.text}` "
|
144
147
|
end
|
data/lib/markitdown/version.rb
CHANGED
data/spec/doc.markdown
CHANGED
data/spec/tag_spec.rb
CHANGED
@@ -137,6 +137,14 @@ describe Markitdown do
|
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
|
+
context "When parsing an delete element that's followed by a punctuation" do
|
141
|
+
let(:html) { "<html><del>delete added</del>.</html>" }
|
142
|
+
|
143
|
+
it "should return valid markdown without a space" do
|
144
|
+
Markitdown.from_html(html).should == " ~~delete added~~."
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
140
148
|
context "When parsing an highlight element that's followed by a punctuation" do
|
141
149
|
let(:html) { "<html><mark>highlight added</mark>.</html>" }
|
142
150
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markitdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-08-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -103,7 +103,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
103
103
|
version: '0'
|
104
104
|
segments:
|
105
105
|
- 0
|
106
|
-
hash:
|
106
|
+
hash: -2638333383769331236
|
107
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
108
|
none: false
|
109
109
|
requirements:
|
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
112
|
version: '0'
|
113
113
|
segments:
|
114
114
|
- 0
|
115
|
-
hash:
|
115
|
+
hash: -2638333383769331236
|
116
116
|
requirements: []
|
117
117
|
rubyforge_project:
|
118
118
|
rubygems_version: 1.8.23
|