Use file inclusion to stay DRY (Don't Repeat Yourself).
Maintain reusable text in a separate file, then include it wherever it's needed.
includee.md
:
Text in includee file.
includer.md
:
Text in includer file.
@[:markdown](includee.md)
The treatment token :markdown
specifies that the included text is to be treated as more markdown.
CLI
markdown_helper include --pristine includer.md included.md
(Option --pristine
suppresses comment insertion.)
API
include.rb
:
require 'markdown_helper'
# Option :pristine suppresses comment insertion.
markdown_helper = MarkdownHelper.new(:pristine => true)
markdown_helper.include('includer.md', 'included.md')
Here's the output file, after inclusion.
included.md
:
Text in includer file.
Text in includee file.