unmarkdown 0.1.0 → 0.1.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
  SHA1:
3
- metadata.gz: 89763c4c6a33be8a9d51bda83db646aa71966e06
4
- data.tar.gz: 0b2588b7f7c9e5d15f6a082cc3a9752169679183
3
+ metadata.gz: e7f0219af3b996010a94e56ffa4e2a04c76b9ee8
4
+ data.tar.gz: 40427768c3886271fc1f9a04a626c5bb3495a55f
5
5
  SHA512:
6
- metadata.gz: aa2ad64dfa026571241613e404c60fe216e218e85cdff364b35cd29531002cd9f4cc04e5ebc71c262e695f6244b58819b7eaf6e15ccc02886ab6a678fbbdc8e3
7
- data.tar.gz: ad77913f14ec92cb9813aa3be5d14d36c23656388d5ba2c7fa0d104e99aac94114d6beac1c3d29baaab9bcdabbbb91fd003cc0b0d3cf27b0608cdb79faacd922
6
+ metadata.gz: 3153b363d7b3368a46a1da6c24882144200a3ddef1faf51519947736885a27fb732501bc627f75edfb87212be99b00901734d7c43ea78c91796095ab77e785f3
7
+ data.tar.gz: 32f0b4ed7937efb8151de4ab595ed348f449197256b379143713b403bd41bc6d094eff7d0a74fa826151b64b68d2957e601d327ef6bc430a8e5a38c7bf84051d
@@ -2,6 +2,10 @@
2
2
 
3
3
  Convert HTML to Markdown with Ruby.
4
4
 
5
+ There are several libraries that solve this, but Unmarkdown is simple. It's only [150 lines](lib/unmarkdown/parser.rb) and handles everything I threw at it with no problem. The other libraries I tried either didn't do recursion correctly or were missing some Markdown extensions I needed. Both were hard to change, so I just whipped this up in a few hours.
6
+
7
+ Enjoy!
8
+
5
9
  ## Installation
6
10
 
7
11
  Add this line to your application's Gemfile:
@@ -24,7 +28,7 @@ Or install it yourself as:
24
28
  markdown = Unmarkdown.parse('Some <strong>HTML</strong>')
25
29
  #=> Some **HTML**
26
30
 
27
- markdown = Unmarkdown.parse('My website is http://soff.es', autolink: true')
31
+ markdown = Unmarkdown.parse('My website is http://soff.es', autolink: true)
28
32
  #=> My website is <a href="http://soff.es">http://soff.es</a>
29
33
  ```
30
34
 
@@ -49,6 +53,8 @@ For tags that aren't supported, their content will be added to the output. Basic
49
53
 
50
54
  ### Options
51
55
 
56
+ All of the options default to `false`. If you'd like to turn additional things on, pass a hash with symbols as the second argument to `Unmarkdown.parse` (see example above).
57
+
52
58
  * `fenced_code_blocks` — Uses three backticks before and after instead of four spaces before each line
53
59
  * `allow_scripts` — By default, script tags are removed. If you set this option to `true` their original HTML will be included in the output
54
60
  * `underline_headers` — By default number signs are added before headers. If you turn this option on, it will use equal signs for h1's or hypens for h2's and the reset will remain number signs.
@@ -93,7 +93,7 @@ module Unmarkdown
93
93
  when 'hr'
94
94
  output << "---\n\n"
95
95
  when 'a'
96
- output << "[#{parse_content(node)}](#{node['href'] + build_title(node)})"
96
+ output << "[#{parse_content(node)}](#{node['href']}#{build_title(node)})"
97
97
  when 'i', 'em'
98
98
  output << "*#{parse_content(node)}*"
99
99
  when 'b', 'strong'
@@ -105,7 +105,7 @@ module Unmarkdown
105
105
  when 'code'
106
106
  output << "`#{parse_content(node)}`"
107
107
  when 'img'
108
- output << "![#{node['alt']}](#{node['src'] + build_title(node)})"
108
+ output << "![#{node['alt']}](#{node['src']}#{build_title(node)})"
109
109
  when 'text'
110
110
  content = parse_content(node)
111
111
 
@@ -1,3 +1,3 @@
1
1
  module Unmarkdown
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unmarkdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Soffes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-15 00:00:00.000000000 Z
11
+ date: 2013-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler