markdown_helper 2.0.0 → 2.1.0
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 +5 -5
- data/Gemfile.lock +1 -1
- data/README.md +74 -208
- data/Rakefile +0 -1
- data/lib/markdown_helper.rb +115 -248
- data/lib/markdown_helper/version.rb +1 -1
- data/markdown/readme/README.template.md +43 -101
- data/markdown/readme/include.md +4 -0
- data/markdown/readme/include_usage.rb +1 -2
- data/markdown/use_cases/Rakefile +28 -31
- data/markdown/use_cases/include_files/diagnose_circular_includes/diagnose_circular_includes.err +1 -1
- data/markdown/use_cases/include_files/diagnose_circular_includes/use_case.md +1 -1
- data/markdown/use_cases/include_files/diagnose_circular_includes/{diagnose_circular_includes.rb → use_case_builder.rb} +1 -2
- data/markdown/use_cases/include_files/diagnose_missing_includee/diagnose_missing_includee.err +1 -1
- data/markdown/use_cases/include_files/diagnose_missing_includee/use_case.md +1 -1
- data/markdown/use_cases/include_files/diagnose_missing_includee/{diagnose_missing_includee.rb → use_case_builder.rb} +1 -2
- data/markdown/use_cases/include_files/include_code_block/{include_code_block.rb → use_case_builder.rb} +1 -2
- data/markdown/use_cases/include_files/include_generated_text/{include_generated_text.rb → use_case_builder.rb} +1 -2
- data/markdown/use_cases/include_files/include_highlighted_code/{include_highlighted_code.rb → use_case_builder.rb} +1 -2
- data/markdown/use_cases/include_files/include_markdown/{include_markdown.rb → use_case_builder.rb} +1 -2
- data/markdown/use_cases/include_files/include_page_toc/included.md +48 -0
- data/markdown/use_cases/include_files/include_page_toc/includer.md +16 -0
- data/markdown/use_cases/include_files/include_page_toc/markdown_0.md +8 -0
- data/markdown/use_cases/include_files/include_page_toc/markdown_1.md +8 -0
- data/markdown/use_cases/include_files/include_page_toc/use_case.md +212 -0
- data/markdown/use_cases/include_files/include_page_toc/use_case_builder.rb +121 -0
- data/markdown/use_cases/include_files/include_page_toc/use_case_template.md +46 -0
- data/markdown/use_cases/include_files/include_text_as_comment/{include_text_as_comment.rb → use_case_builder.rb} +1 -2
- data/markdown/use_cases/include_files/include_text_as_pre/{include_text_as_pre.rb → use_case_builder.rb} +1 -2
- data/markdown/use_cases/include_files/include_use_case.rb +2 -8
- data/markdown/use_cases/include_files/include_with_added_comments/{include_with_added_comments.rb → use_case_builder.rb} +2 -3
- data/markdown/use_cases/include_files/nest_inclusions/{nest_inclusions.rb → use_case_builder.rb} +1 -2
- data/markdown/use_cases/include_files/reuse_text/{reuse_text.rb → use_case_builder.rb} +3 -2
- data/markdown/use_cases/structure.md +10 -0
- data/markdown/use_cases/tables_of_contents/create_and_include_page_toc/included.md +44 -0
- data/markdown/use_cases/tables_of_contents/create_and_include_page_toc/page.md +7 -7
- data/markdown/use_cases/tables_of_contents/create_and_include_page_toc/toc.md +7 -7
- data/markdown/use_cases/tables_of_contents/create_and_include_page_toc/{create_and_include_page_toc.rb → use_case_builder.rb} +1 -2
- data/markdown/use_cases/tables_of_contents/create_page_toc_use_case.rb +1 -1
- data/markdown/use_cases/use_case.rb +14 -15
- data/markdown/use_cases/use_cases.md +2 -4
- data/markdown_helper.gemspec +0 -2
- metadata +24 -29
- data/bin/_resolve +0 -46
- data/bin/resolve +0 -49
- data/bin/usage/resolve.txt +0 -14
- data/images/html.png +0 -0
- data/markdown/readme/resolve_usage.rb +0 -12
- data/markdown/use_cases/include_files/diagnose_missing_includee/included.md +0 -1
- data/markdown/use_cases/resolve/gemify_images/gemify_images.md +0 -11
- data/markdown/use_cases/resolve/gemify_images/gemify_images.rb +0 -68
- data/markdown/use_cases/resolve/gemify_images/relative_image.md +0 -1
- data/markdown/use_cases/resolve/gemify_images/resolved_image.md +0 -1
- data/markdown/use_cases/resolve/gemify_images/template.md +0 -15
- data/markdown/use_cases/resolve/resize_images/template.md +0 -8
data/bin/resolve
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'optparse'
|
4
|
-
|
5
|
-
require 'markdown_helper'
|
6
|
-
|
7
|
-
options = {:pristine => false}
|
8
|
-
|
9
|
-
# Save opts for use below.
|
10
|
-
opts = nil
|
11
|
-
parser = OptionParser.new do |_opts|
|
12
|
-
opts = _opts
|
13
|
-
_opts.banner = "Usage: #{File.basename(__FILE__)} [options] template_file_path markdown_file_path"
|
14
|
-
_opts.on('--pristine', 'No comments added') do |_|
|
15
|
-
options[:pristine] = true
|
16
|
-
end
|
17
|
-
_opts.on('--help', 'Display help') do
|
18
|
-
usage(_opts)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def usage(opts)
|
23
|
-
puts ''
|
24
|
-
puts opts
|
25
|
-
puts <<-EOT
|
26
|
-
|
27
|
-
where
|
28
|
-
|
29
|
-
* template_file_path is the path to an existing file.
|
30
|
-
* markdown_file_path is the path to a file to be created.
|
31
|
-
|
32
|
-
Typically:
|
33
|
-
|
34
|
-
* Both file types are .md.
|
35
|
-
* The template file contains image descriptions.
|
36
|
-
EOT
|
37
|
-
exit
|
38
|
-
end
|
39
|
-
|
40
|
-
parser.parse!
|
41
|
-
|
42
|
-
template_file_path, markdown_file_path = ARGV
|
43
|
-
|
44
|
-
usage(opts) unless ARGV.size == 2
|
45
|
-
usage(opts) unless File.readable?(template_file_path)
|
46
|
-
usage(opts) unless File.writable?(File.dirname(markdown_file_path))
|
47
|
-
|
48
|
-
warn('This resolve is deprecated. Please use command "markdown_helper resolve".')
|
49
|
-
MarkdownHelper.new(options).resolve(template_file_path, markdown_file_path)
|
data/bin/usage/resolve.txt
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
|
2
|
-
Usage: markdown_helper resolve [options] template_file_path markdown_file_path
|
3
|
-
--pristine No comments added
|
4
|
-
--help Display help
|
5
|
-
|
6
|
-
where
|
7
|
-
|
8
|
-
* template_file_path is the path to an existing file.
|
9
|
-
* markdown_file_path is the path to a file to be created.
|
10
|
-
|
11
|
-
Typically:
|
12
|
-
|
13
|
-
* Both file types are .md.
|
14
|
-
* The template file contains image descriptions.
|
data/images/html.png
DELETED
Binary file
|
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'markdown_helper'
|
2
|
-
|
3
|
-
template_file_path = 'template.md'
|
4
|
-
markdown_file_path = 'markdown.md'
|
5
|
-
markdown_helper = MarkdownHelper.new
|
6
|
-
markdown_helper.resolve(template_file_path, markdown_file_path)
|
7
|
-
# Pristine.
|
8
|
-
markdown_helper.pristine = true
|
9
|
-
markdown_helper.resolve(template_file_path, markdown_file_path)
|
10
|
-
# Also pristine.
|
11
|
-
markdown_helper = MarkdownHelper.new(:pristine => true)
|
12
|
-
markdown_helper.resolve(template_file_path, markdown_file_path)
|
@@ -1 +0,0 @@
|
|
1
|
-
@[:markdown](includer_1.md}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
### Gemify Images
|
2
|
-
|
3
|
-
Use the markdown helper to resolve image paths for a Ruby gem.
|
4
|
-
|
5
|
-
When you release your GitHub project to gem at RubyGems.org, the documentation is rebuilt into files on RubyDoc.info. When YARD performs this rebuilding, it does some directory restructuring.
|
6
|
-
|
7
|
-
If a markdown file contains an image description that has a relative file path, that path will not be valid in the documentation on RubyDoc.info, and the image will not display in the documentation.
|
8
|
-
|
9
|
-
To avoid that error, use the markdown helper to resolve the relative path to an absolute path.
|
10
|
-
|
11
|
-
This new absolute path points to a file that's automatically maintained in the GitHub project. For that reason,
|
@@ -1,68 +0,0 @@
|
|
1
|
-
require_relative '../../use_case'
|
2
|
-
|
3
|
-
class GemifyImages < UseCase
|
4
|
-
|
5
|
-
def self.build
|
6
|
-
|
7
|
-
use_case_dir_path = File.absolute_path(File.dirname(__FILE__))
|
8
|
-
|
9
|
-
use_case = self.new(use_case_dir_path)
|
10
|
-
|
11
|
-
reusable_text_file_name = 'reusable_text.md'
|
12
|
-
includer_file_name = 'includer.md'
|
13
|
-
included_file_name = 'included.md'
|
14
|
-
|
15
|
-
resolve_command = use_case.construct_resolve_command(includer_file_name, included_file_name, pristine = true)
|
16
|
-
build_command = use_case.construct_include_command(TEMPLATE_FILE_NAME, USE_CASE_FILE_NAME, pristine = true)
|
17
|
-
|
18
|
-
use_case.commands_to_execute.push(
|
19
|
-
resolve_command,
|
20
|
-
build_command,
|
21
|
-
)
|
22
|
-
|
23
|
-
#
|
24
|
-
# relative_image_file_name = 'relative_image.md'
|
25
|
-
# absolute_image_file_name = 'resolved_image.md'
|
26
|
-
# template_file_name = 'template.md'
|
27
|
-
# use_case_file_name = 'gemify_images.md'
|
28
|
-
#
|
29
|
-
# resolve_command = "markdown_helper resolve --pristine #{relative_image_file_name} #{absolute_image_file_name}"
|
30
|
-
#
|
31
|
-
# File.write(
|
32
|
-
# relative_image_file_name,
|
33
|
-
# <<EOT
|
34
|
-
# 
|
35
|
-
# EOT
|
36
|
-
# )
|
37
|
-
#
|
38
|
-
# # Example resolution.
|
39
|
-
# # system(resolve_command)
|
40
|
-
#
|
41
|
-
# File.write(
|
42
|
-
# template_file_name,
|
43
|
-
# <<EOT
|
44
|
-
# ### Gemify Images
|
45
|
-
#
|
46
|
-
# Use the markdown helper to resolve image paths for a Ruby gem.
|
47
|
-
#
|
48
|
-
# #### The Problem
|
49
|
-
#
|
50
|
-
# When you release your GitHub project to gem at RubyGems.org, the documentation is rebuilt into files on RubyDoc.info. When YARD performs this rebuilding, it does some directory restructuring.
|
51
|
-
#
|
52
|
-
# If a markdown file contains an image description that has a relative file path, that path will not be valid in the documentation on RubyDoc.info, and the image will not display in the documentation.
|
53
|
-
#
|
54
|
-
# #### The Solution
|
55
|
-
#
|
56
|
-
# To avoid that error, use the markdown helper to resolve the relative path to an absolute path.
|
57
|
-
#
|
58
|
-
# This new absolute path points to a file that's automatically maintained in the GitHub project. For that reason,
|
59
|
-
# EOT
|
60
|
-
# )
|
61
|
-
#
|
62
|
-
# # Build use case.
|
63
|
-
# # build_command = "markdown_helper include --pristine #{template_file_name} #{use_case_file_name}"
|
64
|
-
# # system(build_command)
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-

|
@@ -1 +0,0 @@
|
|
1
|
-
<img src="" alt="html_image">
|
@@ -1,15 +0,0 @@
|
|
1
|
-
### Gemify Images
|
2
|
-
|
3
|
-
Use the markdown helper to resolve image paths for a Ruby gem.
|
4
|
-
|
5
|
-
#### The Problem
|
6
|
-
|
7
|
-
When you release your GitHub project to gem at RubyGems.org, the documentation is rebuilt into files on RubyDoc.info. When YARD performs this rebuilding, it does some directory restructuring.
|
8
|
-
|
9
|
-
If a markdown file contains an image description that has a relative file path, that path will not be valid in the documentation on RubyDoc.info, and the image will not display in the documentation.
|
10
|
-
|
11
|
-
#### The Solution
|
12
|
-
|
13
|
-
To avoid that error, use the markdown helper to resolve the relative path to an absolute path.
|
14
|
-
|
15
|
-
This new absolute path points to a file that's automatically maintained in the GitHub project. For that reason,
|
@@ -1,8 +0,0 @@
|
|
1
|
-
### Image Attributes
|
2
|
-
|
3
|
-
Use the markdown helper to assign attributes to images.
|
4
|
-
|
5
|
-
If you're using the markdown helper to [resolve image file paths for a Ruby gem](./rubygem_images.md), you'll be using the GitHub markdown image-description idiom (begins with exclamation point), and not the HTML <code>img</code> idiom.
|
6
|
-
|
7
|
-
The image description does not accept attributes (such as height and width), but the markdown helper does accept those, passing them through to an <code>img</code> HTML element.
|
8
|
-
s
|