Sha256: f8e20a400348832746aa561f27141d5f9b197d5038e223d5a8b44e8e776c9cae

Contents?: true

Size: 1.11 KB

Versions: 7

Compression:

Stored size: 1.11 KB

Contents

### 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```:
```markdown
Text in includee file.
```

#### Includer File

```includer.md```:
```markdown
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 <code>markdown_helper</code>
<details>
<summary>CLI</summary>

```sh
markdown_helper include --pristine includer.md included.md
```

(Option ```--pristine``` suppresses comment insertion.)
</details>
<details>
<summary>API</summary>

```include.rb```:
```ruby
require 'markdown_helper'

# Option :pristine suppresses comment insertion.
markdown_helper = MarkdownHelper.new(:pristine => true)
markdown_helper.include('includer.md', 'included.md')
```

</details>

#### File with Inclusion

Here's the output file, after inclusion.

```included.md```:
```markdown
Text in includer file.

Text in includee file.
```

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
markdown_helper-2.5.4 markdown/use_cases/include/reuse_text/use_case.md
markdown_helper-2.5.3 markdown/use_cases/include/reuse_text/use_case.md
markdown_helper-2.5.2 markdown/use_cases/include/reuse_text/use_case.md
markdown_helper-2.5.1 markdown/use_cases/include/reuse_text/use_case.md
markdown_helper-2.5.0 markdown/use_cases/include/reuse_text/use_case.md
markdown_helper-2.4.0 markdown/use_cases/include/reuse_text/use_case.md
markdown_helper-2.3.0 markdown/use_cases/include_files/reuse_text/use_case.md