extended-markdown-filter 0.4.6 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +8 -2
- data/README.md +19 -6
- data/extended-markdown-filter.gemspec +1 -1
- data/lib/filters/pre/command-line.rb +6 -6
- data/test/fixtures/command_line_indented.md +6 -0
- data/test/test_extended_markdown_filter.rb +13 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fbd677ca783661a274b905b28823a0f3caa7ab0
|
4
|
+
data.tar.gz: 01b74dc9163510f34cf772043b778b8b22e9c6f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05317b1c16e27dbd2523980fa5861e8b7147a7b435144faf879ef25f0dd983284fb07c51dd3a2789b2eb00b9a5cc8213fb530c5deaa5824bd4d910315af68f79
|
7
|
+
data.tar.gz: e25e070dbac753840d2e9594aef9282ceebdf0bb3a515455d35e5a3c4e243b94aab8856ef6be2b5accf23b7c1afad4048f7aca65718db49eda830ed04245e896
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
extended-markdown-filter
|
2
|
-
====================
|
1
|
+
# extended-markdown-filter
|
3
2
|
|
4
3
|
Extended Markdown filters for the [HTML::Pipeline](https://github.com/jch/html-pipeline).
|
5
4
|
|
@@ -27,7 +26,21 @@ The simplest way to do this is
|
|
27
26
|
require 'extended-markdown-filter'
|
28
27
|
```
|
29
28
|
|
30
|
-
Then just use the HTML pipeline normally.
|
29
|
+
Then just use the HTML pipeline normally. With Jekyll, this is meant to be used with another plugin in conjunction, https://github.com/gjtorikian/jekyll-html-pipeline.
|
30
|
+
|
31
|
+
A minimum config file might look like:
|
32
|
+
``` yaml
|
33
|
+
gems:
|
34
|
+
- extended-markdown-filter
|
35
|
+
- jekyll-html-pipeline
|
36
|
+
|
37
|
+
markdown: HTMLPipeline
|
38
|
+
html_pipeline:
|
39
|
+
filters:
|
40
|
+
- "ExtendedMarkdownFilter"
|
41
|
+
context:
|
42
|
+
emf_use_blocks: true
|
43
|
+
```
|
31
44
|
|
32
45
|
### Within Jekyll
|
33
46
|
|
@@ -78,12 +91,12 @@ You can create separate, priority-colored callouts with `{{#tip}}`, `{{#note}}`,
|
|
78
91
|
Here's a hot tip: line two
|
79
92
|
|
80
93
|
{{/tip}}
|
81
|
-
|
94
|
+
|
82
95
|
{{#note}}
|
83
|
-
|
96
|
+
|
84
97
|
You should probably know this! line one
|
85
98
|
You should probably know this! line two
|
86
|
-
|
99
|
+
|
87
100
|
{{/note}}
|
88
101
|
|
89
102
|
{{#warning}}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "extended-markdown-filter"
|
3
|
-
spec.version = "0.4.
|
3
|
+
spec.version = "0.4.7"
|
4
4
|
spec.authors = ["Garen Torikian"]
|
5
5
|
spec.email = ["gjtorikian@gmail.com"]
|
6
6
|
spec.summary = %q{Add extended markup syntax to the HTML::Pipeline}
|
@@ -1,12 +1,12 @@
|
|
1
1
|
module Filters
|
2
2
|
module PreFilter
|
3
3
|
def format_command_line(text)
|
4
|
-
text.gsub /\n
|
5
|
-
block.gsub!
|
6
|
-
block.gsub!
|
7
|
-
block.gsub!(
|
8
|
-
block.gsub!(
|
9
|
-
block.gsub!(
|
4
|
+
text.gsub /\n?\s*``` command-line(.+?)```/m do |block|
|
5
|
+
block.gsub! /^\s*``` command-line/, '<pre class="command-line">'
|
6
|
+
block.gsub! /^\s*```$/, "</pre>\n"
|
7
|
+
block.gsub!(/^\s*\$ (.+)$/) { %(<span class="command">#{$1.rstrip}</span>) }
|
8
|
+
block.gsub!(/^\s*(\# .+)$/) { %(<span class="comment">#{$1.rstrip}</span>) }
|
9
|
+
block.gsub!(/^\s*> (.+)$/) { %(<span class="output">#{$1.rstrip}</span>) }
|
10
10
|
|
11
11
|
block
|
12
12
|
end
|
@@ -18,6 +18,19 @@ class HTML::Pipeline::ExtendedMarkdownFilterTest < Minitest::Test
|
|
18
18
|
assert_equal 0, doc.css('.command-line a').size
|
19
19
|
end
|
20
20
|
|
21
|
+
def test_command_line_indented
|
22
|
+
doc = ExtendedMarkdownFilter.to_document(fixture("command_line_indented.md"), {})
|
23
|
+
assert doc.kind_of?(HTML::Pipeline::DocumentFragment)
|
24
|
+
|
25
|
+
assert_equal 1, doc.css('pre').size
|
26
|
+
assert_equal 2, doc.css('span.command').size
|
27
|
+
assert_equal 1, doc.css('span.comment').size
|
28
|
+
assert_equal 2, doc.css('em').size
|
29
|
+
assert_equal 1, doc.css('span.output').size
|
30
|
+
|
31
|
+
assert_equal 0, doc.css('.command-line a').size
|
32
|
+
end
|
33
|
+
|
21
34
|
def test_helper
|
22
35
|
doc = ExtendedMarkdownFilter.to_document(fixture("helper.md"), {})
|
23
36
|
assert doc.kind_of?(HTML::Pipeline::DocumentFragment)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: extended-markdown-filter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: html-pipeline
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- test/fixtures/block_octicon.md
|
124
124
|
- test/fixtures/block_os_blocks.md
|
125
125
|
- test/fixtures/command_line.md
|
126
|
+
- test/fixtures/command_line_indented.md
|
126
127
|
- test/fixtures/helper.md
|
127
128
|
- test/fixtures/intro.md
|
128
129
|
- test/fixtures/octicon.md
|
@@ -160,6 +161,7 @@ test_files:
|
|
160
161
|
- test/fixtures/block_octicon.md
|
161
162
|
- test/fixtures/block_os_blocks.md
|
162
163
|
- test/fixtures/command_line.md
|
164
|
+
- test/fixtures/command_line_indented.md
|
163
165
|
- test/fixtures/helper.md
|
164
166
|
- test/fixtures/intro.md
|
165
167
|
- test/fixtures/octicon.md
|