guard-markdown 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +64 -0
- data/guard-markdown.gemspec +1 -1
- data/lib/guard/markdown/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -0,0 +1,64 @@
|
|
1
|
+
# Guard::Markdown #
|
2
|
+
Markdown guard will watch your markdown documents for changes and convert them to lovely, semantic html. Yay!
|
3
|
+
|
4
|
+
## Install ##
|
5
|
+
|
6
|
+
You're going to need [Guard](https://github.com/guard/guard) too.
|
7
|
+
|
8
|
+
Install with
|
9
|
+
|
10
|
+
$ gem install guard-markdown
|
11
|
+
|
12
|
+
Or add it to your Gemfile
|
13
|
+
|
14
|
+
gem 'guard-markdown'
|
15
|
+
|
16
|
+
## Usage ##
|
17
|
+
|
18
|
+
Go see the [Guard usage doc](https://github.com/guard/guard#readme) for general instructions
|
19
|
+
|
20
|
+
## The Guardfile - where the magic happens
|
21
|
+
|
22
|
+
The Guardfile is where you define your desired input and output paths.
|
23
|
+
Create it with:
|
24
|
+
|
25
|
+
$ guard init markdown
|
26
|
+
|
27
|
+
Then tweak the watch statements to your hearts content. It'll look a lot like this:
|
28
|
+
|
29
|
+
guard 'markdown', :convert_on_start => true, :dry_run => true do
|
30
|
+
watch (/source_dir\/(.+\/)*(.+\.)(md|markdown)/i) { |m| "source_dir/#{m[1]}#{m[2]}#{m[3]}|output_dir/#{m[1]}#{m[2]}html"}
|
31
|
+
end
|
32
|
+
|
33
|
+
The guard statement defines which guard your configuring and sets any optional parameters.
|
34
|
+
|
35
|
+
* :convert_on_start - if true will run all conversions when you start the guard. Defaults to true
|
36
|
+
* :dry_run - if true won't actually run the conversion process, but it will output the files being watched and the file it would write to. Use it to tweak your watch statements and when you're happy set it to false.
|
37
|
+
|
38
|
+
The watch statement - ok, it may look a little intimidating. You'll need to know your regular expressions. But this is what it's doing.
|
39
|
+
|
40
|
+
watch (/source_dir\/(.+\/)*(.+\.)(md|markdown)/i) { |m| "source_dir/#{m[1]}#{m[2]}#{m[3]}|output_dir/#{m[1]}#{m[2]}html"}
|
41
|
+
|
42
|
+
^ ------ input file pattern ----------- ^ ^ ---- input file path -------- ^|^ ----- output file path ---^
|
43
|
+
|
44
|
+
The "input file pattern" is a regular expression that is used to determine which files are watched by the guard. It'll be applied recursively to all files and folders starting in the current working directory.
|
45
|
+
|
46
|
+
Any matches are passed into the block and used to construct the conversion command. The conversion command is a string containing the path to the source file and the desired path to the output file separated by a "|"
|
47
|
+
|
48
|
+
I hope that makes sense :)
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
## Have Fun ##
|
53
|
+
|
54
|
+
Go see the other [great guards available](https://github.com/guard/guard/wiki/List-of-available-Guards)
|
55
|
+
|
56
|
+
Oh yeah, I'm using [Kramdown](http://kramdown.rubyforge.org/) for the conversion engine. So if you want to know what markdown syntax it supports, [go here](http://kramdown.rubyforge.org/syntax.html)
|
57
|
+
|
58
|
+
# TODO #
|
59
|
+
|
60
|
+
* Simplify the required watch statement
|
61
|
+
* Seems a little wasteful to have to recreate the input path in the regexp. Must find a way around it.
|
62
|
+
* Allow the passing of Kramdown options into the guard
|
63
|
+
* Allow the conversion of more doc types using Kramdown
|
64
|
+
|
data/guard-markdown.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.version = Guard::MarkdownVersion::VERSION
|
8
8
|
s.authors = ["Darren Wallace"]
|
9
9
|
s.email = ["wallace@midweekcrisis.com"]
|
10
|
-
s.homepage = ""
|
10
|
+
s.homepage = "https://github.com/darwalenator/guard-markdown"
|
11
11
|
s.summary = %q{Markdown folder > html folder conversion}
|
12
12
|
s.description = %q{Watches a source folder and converts markdown docs to html docs in a target folder}
|
13
13
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: guard-markdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Darren Wallace
|
@@ -101,7 +101,7 @@ files:
|
|
101
101
|
- lib/guard/markdown/version.rb
|
102
102
|
- spec/lib/guard/markdown_spec.rb
|
103
103
|
- spec/spec_helper.rb
|
104
|
-
homepage:
|
104
|
+
homepage: https://github.com/darwalenator/guard-markdown
|
105
105
|
licenses: []
|
106
106
|
|
107
107
|
post_install_message:
|