extended-markdown-filter 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +108 -0
- data/extended-markdown-filter.gemspec +1 -1
- data/lib/filters/pre/command-line.rb +7 -3
- data/test/fixtures/command_line_list.md +29 -0
- data/test/test_extended_markdown_filter.rb +5 -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: 555bea313bb40a9b286a9916a4bc3a87c258771d
|
4
|
+
data.tar.gz: 3780420bd64f8cd2034ccbecb60a34d0e467c881
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a56659b608016e369af761743454e54403ebff307a5904b5a98e75c22ac672c3be491c80bc1e6c1ffc7a5d2350fa43ed43ef79c2e222e26dc37c2da2e9fde832
|
7
|
+
data.tar.gz: 86eb129658b054247d53dd1acb6ae9d075e94c850a79a5cecc067b0003127a6d2f7c41b5fd591753cd08750b91b4711ce1abc7b183c2ccd3544d92f9777ff9c0
|
data/README.md
CHANGED
@@ -34,3 +34,111 @@ Then just use the HTML pipeline normally.
|
|
34
34
|
Because of the Liquid template engine, if you use this filter with Jekyll, you might find that your curly brace tags--such as `{{#tip}}`--disappear.
|
35
35
|
|
36
36
|
You'll need to pass the context `emf_use_blocks` through your filter. This sets up a totally safe monkey-patch to convert the `{{ }}` blocks into `[[ ]]`, so that Liquid ignores them. Then, this renderer will convert the Markdown appropriately.
|
37
|
+
|
38
|
+
## What does this add?
|
39
|
+
|
40
|
+
You may be wondering what features this filter adds to Markdown. Great question! Here's what we've got:
|
41
|
+
|
42
|
+
### Command-line highlighting
|
43
|
+
|
44
|
+
A new pre block, `command-line`, adds some divs to allow for better highlighting for terminal code.
|
45
|
+
|
46
|
+
#### Example
|
47
|
+
|
48
|
+
``` command-line
|
49
|
+
$ git remote add origin https://github.com/<em>user</em>/<em>repo</em>.git
|
50
|
+
# Set a new remote
|
51
|
+
> origin https://github.com/user/repo.git
|
52
|
+
```
|
53
|
+
|
54
|
+
* `$` represents content a user enters
|
55
|
+
* `<em>` highlights content for the user
|
56
|
+
* `#` represents comments
|
57
|
+
* `>` represents output as a result of a command
|
58
|
+
|
59
|
+
### Helper
|
60
|
+
|
61
|
+
The `helper` notation wraps content in an [accordion fold](http://jqueryui.com/accordion/).
|
62
|
+
|
63
|
+
#### Example
|
64
|
+
|
65
|
+
``` helper
|
66
|
+
I'm not really important enough to show.
|
67
|
+
```
|
68
|
+
|
69
|
+
### Admonition blocks
|
70
|
+
|
71
|
+
You can create separate, priority-colored callouts with `{{#tip}}`, `{{#warning}}`, and `{{#error}}` tags.
|
72
|
+
|
73
|
+
#### Example
|
74
|
+
|
75
|
+
{{#tip}}
|
76
|
+
|
77
|
+
Here's a hot tip: **line one**
|
78
|
+
Here's a hot tip: line two
|
79
|
+
|
80
|
+
{{/tip}}
|
81
|
+
|
82
|
+
{{#warning}}
|
83
|
+
|
84
|
+
Yo, check this out: line one
|
85
|
+
Yo, check this out: line two
|
86
|
+
|
87
|
+
{{/warning}}
|
88
|
+
|
89
|
+
{{#error}}
|
90
|
+
|
91
|
+
Sheeeeit, this is a problem: ~~line one~~
|
92
|
+
Sheeeeit, this is a problem: line two
|
93
|
+
|
94
|
+
{{/error}}
|
95
|
+
|
96
|
+
### Intro
|
97
|
+
|
98
|
+
The `intro` block demarcates a special section that provides a summary of the content to follow.
|
99
|
+
|
100
|
+
#### Example
|
101
|
+
|
102
|
+
{{#intro}}
|
103
|
+
|
104
|
+
[Gists](https://gist.github.com) are a great way to share your work. You can share single files, parts of files, or full applications.
|
105
|
+
|
106
|
+
{{/intro}}
|
107
|
+
|
108
|
+
### Octicon
|
109
|
+
|
110
|
+
The `{{ octicon }}` helper lets you easily render [any Octicon](https://octicons.github.com/) in the content, including an aria label.
|
111
|
+
|
112
|
+
#### Example
|
113
|
+
|
114
|
+
{{ octicon-gear The Settings gear }}
|
115
|
+
|
116
|
+
### Operating system blocks
|
117
|
+
|
118
|
+
Sometimes, certain content needs to be rendered for only a certain operating system. Use `{{#mac}}` of Mac OS specific content, `{{#windows}}` for Windows, `{{#linux}}` for Linux, and `{{#all}}` as a catch-all for everything else.
|
119
|
+
|
120
|
+
#### Example
|
121
|
+
|
122
|
+
{{#mac}}
|
123
|
+
|
124
|
+
1. Command-click on the option.
|
125
|
+
|
126
|
+
{{/mac}}
|
127
|
+
|
128
|
+
{{#windows}}
|
129
|
+
|
130
|
+
1. Right click on the **Start** menu.
|
131
|
+
|
132
|
+
{{/windows}}
|
133
|
+
|
134
|
+
{{#linux}}
|
135
|
+
|
136
|
+
1. Open the terminal.
|
137
|
+
|
138
|
+
{{/linux}}
|
139
|
+
|
140
|
+
{{#all}}
|
141
|
+
|
142
|
+
1. Double-click on the icon.
|
143
|
+
|
144
|
+
{{/all}}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "extended-markdown-filter"
|
3
|
-
spec.version = "0.3.
|
3
|
+
spec.version = "0.3.4"
|
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,9 +1,13 @@
|
|
1
1
|
module Filters
|
2
2
|
module PreFilter
|
3
3
|
def format_command_line!(text)
|
4
|
-
text.gsub!
|
5
|
-
|
6
|
-
block.
|
4
|
+
text.gsub! /((`{3}\s*)(command-line)?(\s*([\w\W]+?)\n*)\2)\n*(?:[^\S\w\s]|$)/m do |block|
|
5
|
+
str = $5.dup
|
6
|
+
return block unless str.lines.to_a[0].chomp == "command-line"
|
7
|
+
str = str.lines.to_a[1..-1].join
|
8
|
+
|
9
|
+
block.gsub! /``` command-line/, '<pre class="command-line">'
|
10
|
+
block.gsub! /```/, "</pre>\n"
|
7
11
|
block.gsub!(/^\$ (.+)$/) { %Q|<span class="command">#{$1.rstrip}</span>| }
|
8
12
|
block.gsub!(/^(\# .+)$/) { %Q|<span class="comment">#{$1.rstrip}</span>| }
|
9
13
|
block.gsub!(/^> (.+)$/) { %Q|<span class="output"><span># </span>#{$1.rstrip}</span>| }
|
@@ -0,0 +1,29 @@
|
|
1
|
+
1. On the command line, navigate to the repository that contains the commit you want to amend.
|
2
|
+
2. Use the `git rebase -i HEAD~n` command to display a list of the last `n` commits in your default text editor.
|
3
|
+
``` command-line
|
4
|
+
$ git rebase -i HEAD~3 # Displays a list of the last 3 commits on the current branch
|
5
|
+
```
|
6
|
+
The list will look similar to the following:
|
7
|
+
``` command-line
|
8
|
+
pick e499d89 Delete CNAME
|
9
|
+
pick 0c39034 Better README
|
10
|
+
pick f7fde4a Change the commit message but push the same commit.
|
11
|
+
|
12
|
+
# Rebase 9fdb3bd..f7fde4a onto 9fdb3bd
|
13
|
+
#
|
14
|
+
# Commands:
|
15
|
+
# p, pick = use commit
|
16
|
+
# r, reword = use commit, but edit the commit message
|
17
|
+
# e, edit = use commit, but stop for amending
|
18
|
+
# s, squash = use commit, but meld into previous commit
|
19
|
+
# f, fixup = like "squash", but discard this commit's log message
|
20
|
+
# x, exec = run command (the rest of the line) using shell
|
21
|
+
#
|
22
|
+
# These lines can be re-ordered; they are executed from top to bottom.
|
23
|
+
#
|
24
|
+
# If you remove a line here THAT COMMIT WILL BE LOST.
|
25
|
+
#
|
26
|
+
# However, if you remove everything, the rebase will be aborted.
|
27
|
+
#
|
28
|
+
# Note that empty commits are commented out
|
29
|
+
```
|
@@ -14,6 +14,11 @@ class HTML::Pipeline::ExtendedMarkdownFilterTest < Minitest::Test
|
|
14
14
|
assert_equal 1, doc.css('span.comment').size
|
15
15
|
assert_equal 2, doc.css('em').size
|
16
16
|
assert_equal 1, doc.css('span.output').size
|
17
|
+
|
18
|
+
doc = ExtendedMarkdownFilter.to_document(fixture("command_line_list.md"), {})
|
19
|
+
assert doc.kind_of?(HTML::Pipeline::DocumentFragment)
|
20
|
+
|
21
|
+
assert_equal 2, doc.css('li pre.command-line').size
|
17
22
|
end
|
18
23
|
|
19
24
|
def test_helper
|
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.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: html-pipeline
|
@@ -109,6 +109,7 @@ files:
|
|
109
109
|
- test/fixtures/block_octicon.md
|
110
110
|
- test/fixtures/block_os_blocks.md
|
111
111
|
- test/fixtures/command_line.md
|
112
|
+
- test/fixtures/command_line_list.md
|
112
113
|
- test/fixtures/helper.md
|
113
114
|
- test/fixtures/intro.md
|
114
115
|
- test/fixtures/octicon.md
|
@@ -146,6 +147,7 @@ test_files:
|
|
146
147
|
- test/fixtures/block_octicon.md
|
147
148
|
- test/fixtures/block_os_blocks.md
|
148
149
|
- test/fixtures/command_line.md
|
150
|
+
- test/fixtures/command_line_list.md
|
149
151
|
- test/fixtures/helper.md
|
150
152
|
- test/fixtures/intro.md
|
151
153
|
- test/fixtures/octicon.md
|