Skip to content

Latest commit

 

History

History
58 lines (40 loc) · 1.06 KB

File metadata and controls

58 lines (40 loc) · 1.06 KB

Reuse Text

Use file inclusion to stay DRY (Don't Repeat Yourself).

Maintain reusable text in a separate file, then include it wherever it's needed.

File To Be Included

includee.md:

Text in includee file.

Includer 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.

Include Via markdown_helper

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')

File with Inclusion

Here's the output file, after inclusion.

included.md:

Text in includer file.

Text in includee file.