markdown_helper 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +49 -23
- data/bin/include +23 -0
- data/bin/usage/include.txt +13 -0
- data/lib/markdown_helper/version.rb +1 -1
- data/markdown_helper.gemspec +38 -38
- data/readme/README.template.md +24 -13
- data/readme/include.md +3 -3
- 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: b7cb1906c0c35ce609ca9b60c12ec703f6b0c399
|
4
|
+
data.tar.gz: 33acb05767e8cf7f49eafcb8363772b37be0d90f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d83a737645f7b576cfb65f0dd829f057d4d6e0f8638b5c2f9daba6adb459d0acb740d2a0c32a613d82d0e4916244268556a061b50134b3b22a3e7e9af0457d67
|
7
|
+
data.tar.gz: 004c46825e01715047c21aa8b106f9f3c6857f4fc590550c252b61d97fb579fcb21ccff7eac24c039ec22d0b8b62f9904c30d99169fc05baffc13123b65ec91e
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -4,11 +4,13 @@
|
|
4
4
|
|
5
5
|
This markdown helper enables file inclusion in GitHub markdown.
|
6
6
|
|
7
|
-
(Actually this README file is built using
|
7
|
+
(Actually, this README file itself is built using file inclusion.)
|
8
8
|
|
9
|
-
|
9
|
+
Use the markdown helper to merge external files into a markdown (</code>.md</code>) file.
|
10
10
|
|
11
|
-
|
11
|
+
### Merged Text Formats
|
12
|
+
|
13
|
+
#### Highlighted Code Block
|
12
14
|
|
13
15
|
<code>include.rb</code>
|
14
16
|
```ruby
|
@@ -19,7 +21,7 @@ class RubyCode
|
|
19
21
|
end
|
20
22
|
```
|
21
23
|
|
22
|
-
|
24
|
+
#### Plain Code Block
|
23
25
|
|
24
26
|
<code>include.rb</code>
|
25
27
|
```
|
@@ -30,37 +32,34 @@ class RubyCode
|
|
30
32
|
end
|
31
33
|
```
|
32
34
|
|
33
|
-
|
34
|
-
|
35
|
-
[Note: RubyGems.org chooses to highlight both code blocks above. Go figure.]
|
35
|
+
[Note: In the gem documentation, RubyDoc.info chooses to highlight this code block regardless. Go figure.]
|
36
36
|
|
37
|
-
|
37
|
+
#### Verbatim
|
38
38
|
|
39
|
-
|
39
|
+
Verbatim text is included unadorned. Most often, verbatim text is markdown to be rendered as part of the markdown page.
|
40
40
|
|
41
|
-
|
42
|
-
```verbatim
|
43
|
-
@[ruby](include.rb)
|
41
|
+
### Usage
|
44
42
|
|
45
|
-
|
43
|
+
#### CLI
|
46
44
|
|
47
|
-
|
45
|
+
<code>include.txt</code>
|
48
46
|
```
|
47
|
+
Usage:
|
49
48
|
|
50
|
-
|
49
|
+
include template_file_path markdown_file_page
|
51
50
|
|
52
|
-
|
51
|
+
where
|
53
52
|
|
54
|
-
|
53
|
+
* template_file_path is the path to an existing file.
|
54
|
+
* markdown_file_path is the path to a file to be created.
|
55
55
|
|
56
|
-
|
57
|
-
* Highlighting mode such as <code>[ruby]</code>, to include a highlighted code block. This can be any Ace mode mentioned in [GitHub Languages](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml).
|
58
|
-
* <code>[:code_block]</code>, to include a plain code block.
|
59
|
-
* <code>[:verbatim]</code>, to include text verbatim (to be rendered as markdown).
|
60
|
-
* *relative_file_path* points to the file to be included.
|
56
|
+
Typically:
|
61
57
|
|
58
|
+
* Both file types are .md.
|
59
|
+
* The template file contains file inclusion pragmas. See README.md.
|
60
|
+
```
|
62
61
|
|
63
|
-
####
|
62
|
+
#### API
|
64
63
|
|
65
64
|
<code>usage.rb</code>
|
66
65
|
```ruby
|
@@ -71,3 +70,30 @@ template_file_path = 'highlight_ruby_template.md'
|
|
71
70
|
markdown_file_path = 'highlighted_ruby.rb'
|
72
71
|
markdown_helper.include(template_file_path, markdown_file_path)
|
73
72
|
```
|
73
|
+
|
74
|
+
#### Include Pragmas
|
75
|
+
|
76
|
+
Specify each file inclusion via an *include pragma*, which has the form:
|
77
|
+
|
78
|
+
<code>@[</code>*format*<code>](</code>*relative_file_path*<code>)</code>
|
79
|
+
|
80
|
+
where:
|
81
|
+
|
82
|
+
* *format* (in square brackets) is one of the following:
|
83
|
+
* Highlighting mode such as <code>[ruby]</code>, to include a highlighted code block. This can be any Ace mode mentioned in [GitHub Languages](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml).
|
84
|
+
* <code>[:code_block]</code>, to include a plain code block.
|
85
|
+
* <code>[:verbatim]</code>, to include text verbatim (to be rendered as markdown).
|
86
|
+
* *relative_file_path* points to the file to be included.
|
87
|
+
|
88
|
+
##### Example Include Pragmas
|
89
|
+
|
90
|
+
<code>include.md</code>
|
91
|
+
```verbatim
|
92
|
+
@[ruby](my_ruby.rb)
|
93
|
+
|
94
|
+
@[:code_block](my_language.xyzzy)
|
95
|
+
|
96
|
+
@[:verbatim](my_markdown.md)
|
97
|
+
```
|
98
|
+
|
99
|
+
|
data/bin/include
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'markdown_helper'
|
4
|
+
|
5
|
+
def usage
|
6
|
+
dir_path = File.dirname(File.absolute_path(__FILE__))
|
7
|
+
file_path = File.join(
|
8
|
+
dir_path,
|
9
|
+
'usage',
|
10
|
+
'include.txt'
|
11
|
+
)
|
12
|
+
puts File.read(file_path)
|
13
|
+
exit
|
14
|
+
end
|
15
|
+
|
16
|
+
template_file_path, markdown_file_path = ARGV
|
17
|
+
|
18
|
+
usage unless ARGV.size == 2
|
19
|
+
usage unless File.readable?(template_file_path)
|
20
|
+
usage unless File.writable?(File.dirname(markdown_file_path))
|
21
|
+
|
22
|
+
MarkdownHelper.new.include(template_file_path, markdown_file_path)
|
23
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Usage:
|
2
|
+
|
3
|
+
include template_file_path markdown_file_page
|
4
|
+
|
5
|
+
where
|
6
|
+
|
7
|
+
* template_file_path is the path to an existing file.
|
8
|
+
* markdown_file_path is the path to a file to be created.
|
9
|
+
|
10
|
+
Typically:
|
11
|
+
|
12
|
+
* Both file types are .md.
|
13
|
+
* The template file contains file inclusion pragmas. See README.md.
|
data/markdown_helper.gemspec
CHANGED
@@ -1,38 +1,38 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'markdown_helper/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = 'markdown_helper'
|
8
|
-
spec.version = MarkdownHelper::VERSION
|
9
|
-
spec.authors = ['burdettelamar']
|
10
|
-
spec.email = ['BurdetteLamar@Yahoo.com']
|
11
|
-
|
12
|
-
spec.summary = 'Class to help with GitHub markdown.'
|
13
|
-
spec.description = 'Class to help with GitHub markdown. So far: file inclusion.'
|
14
|
-
spec.homepage = 'https://rubygems.org/gems/markdown_helper'
|
15
|
-
spec.license = 'MIT'
|
16
|
-
|
17
|
-
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
-
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
-
# if spec.respond_to?(:metadata)
|
20
|
-
# spec.metadata['allowed_push_host'] = 'https://rubygems.org/'
|
21
|
-
# spec.metadata['allowed_push_host'] = "http://rubygems.org"
|
22
|
-
# else
|
23
|
-
# raise 'RubyGems 2.0 or newer is required to protect against ' \
|
24
|
-
# 'public gem pushes.'
|
25
|
-
# end
|
26
|
-
|
27
|
-
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
28
|
-
f.match(%r{^(test|spec|features)/})
|
29
|
-
end
|
30
|
-
spec.bindir = 'exe'
|
31
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
32
|
-
spec.require_paths = ['lib']
|
33
|
-
|
34
|
-
spec.add_development_dependency 'bundler', '~> 1.14'
|
35
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
36
|
-
spec.add_development_dependency 'minitest', '~> 5.0'
|
37
|
-
spec.add_development_dependency 'diff-lcs', '~> 1.3'
|
38
|
-
end
|
1
|
+
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'markdown_helper/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'markdown_helper'
|
8
|
+
spec.version = MarkdownHelper::VERSION
|
9
|
+
spec.authors = ['burdettelamar']
|
10
|
+
spec.email = ['BurdetteLamar@Yahoo.com']
|
11
|
+
|
12
|
+
spec.summary = 'Class to help with GitHub markdown.'
|
13
|
+
spec.description = 'Class to help with GitHub markdown. So far: file inclusion.'
|
14
|
+
spec.homepage = 'https://rubygems.org/gems/markdown_helper'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
# if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata['allowed_push_host'] = 'https://rubygems.org/'
|
21
|
+
# spec.metadata['allowed_push_host'] = "http://rubygems.org"
|
22
|
+
# else
|
23
|
+
# raise 'RubyGems 2.0 or newer is required to protect against ' \
|
24
|
+
# 'public gem pushes.'
|
25
|
+
# end
|
26
|
+
|
27
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
28
|
+
f.match(%r{^(test|spec|features)/})
|
29
|
+
end
|
30
|
+
spec.bindir = 'exe'
|
31
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
32
|
+
spec.require_paths = ['lib']
|
33
|
+
|
34
|
+
spec.add_development_dependency 'bundler', '~> 1.14'
|
35
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
36
|
+
spec.add_development_dependency 'minitest', '~> 5.0'
|
37
|
+
spec.add_development_dependency 'diff-lcs', '~> 1.3'
|
38
|
+
end
|
data/readme/README.template.md
CHANGED
@@ -4,41 +4,52 @@
|
|
4
4
|
|
5
5
|
This markdown helper enables file inclusion in GitHub markdown.
|
6
6
|
|
7
|
-
(Actually this README file is built using
|
7
|
+
(Actually, this README file itself is built using file inclusion.)
|
8
8
|
|
9
|
-
|
9
|
+
Use the markdown helper to merge external files into a markdown (</code>.md</code>) file.
|
10
10
|
|
11
|
-
|
11
|
+
### Merged Text Formats
|
12
|
+
|
13
|
+
#### Highlighted Code Block
|
12
14
|
|
13
15
|
@[ruby](include.rb)
|
14
16
|
|
15
|
-
|
17
|
+
#### Plain Code Block
|
16
18
|
|
17
19
|
@[:code_block](include.rb)
|
18
20
|
|
19
|
-
|
21
|
+
[Note: In the gem documentation, RubyDoc.info chooses to highlight this code block regardless. Go figure.]
|
22
|
+
|
23
|
+
#### Verbatim
|
20
24
|
|
21
|
-
|
25
|
+
Verbatim text is included unadorned. Most often, verbatim text is markdown to be rendered as part of the markdown page.
|
22
26
|
|
23
27
|
### Usage
|
24
28
|
|
25
|
-
####
|
29
|
+
#### CLI
|
26
30
|
|
27
|
-
@[
|
31
|
+
@[:code_block](../bin/usage/include.txt)
|
32
|
+
|
33
|
+
#### API
|
34
|
+
|
35
|
+
@[ruby](usage.rb)
|
36
|
+
|
37
|
+
#### Include Pragmas
|
28
38
|
|
29
|
-
|
39
|
+
Specify each file inclusion via an *include pragma*, which has the form:
|
30
40
|
|
31
|
-
<code>@[</code>*
|
41
|
+
<code>@[</code>*format*<code>](</code>*relative_file_path*<code>)</code>
|
32
42
|
|
33
43
|
where:
|
34
44
|
|
35
|
-
* *
|
45
|
+
* *format* (in square brackets) is one of the following:
|
36
46
|
* Highlighting mode such as <code>[ruby]</code>, to include a highlighted code block. This can be any Ace mode mentioned in [GitHub Languages](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml).
|
37
47
|
* <code>[:code_block]</code>, to include a plain code block.
|
38
48
|
* <code>[:verbatim]</code>, to include text verbatim (to be rendered as markdown).
|
39
49
|
* *relative_file_path* points to the file to be included.
|
40
50
|
|
51
|
+
##### Example Include Pragmas
|
52
|
+
|
53
|
+
@[verbatim](include.md)
|
41
54
|
|
42
|
-
#### Include the Files with <code>MarkdownHelper#include</code>
|
43
55
|
|
44
|
-
@[ruby](usage.rb)
|
data/readme/include.md
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markdown_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- burdettelamar
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -83,7 +83,9 @@ files:
|
|
83
83
|
- README.md
|
84
84
|
- Rakefile
|
85
85
|
- bin/console
|
86
|
+
- bin/include
|
86
87
|
- bin/setup
|
88
|
+
- bin/usage/include.txt
|
87
89
|
- images/include.png
|
88
90
|
- lib/markdown_helper.rb
|
89
91
|
- lib/markdown_helper/version.rb
|