Sha256: e152f0cf00cc5b92534d7db2aba79314e6906bf876a4b06790b7f4f38832d180

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

### Use Case: 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

Here's a file containing some text that can be included:

<code>reusable_text.md</code>
```
This is some useful text that can be included in more than one place (actually, in more than one file).
```

#### Includer File

Here's a template file that includes it:

<code>includer.md</code>
```
This file includes the useful text.

@[:verbatim](reusable_text.md)
```

#### Command

Here's the command to perform the inclusion (```--pristine``` suppresses inclusion comments):

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

#### File with Inclusion

Here's the finished file with the inclusion:

<code>included.md</code>
```
<!-- >>>>>> BEGIN GENERATED FILE (include): SOURCE includer.md -->
This file includes the useful text.

<!-- >>>>>> BEGIN INCLUDED FILE (verbatim): SOURCE ./reusable_text.md -->
This is some useful text that can be included in more than one place (actually, in more than one file).
<!-- <<<<<< END INCLUDED FILE (verbatim): SOURCE ./reusable_text.md -->
<!-- <<<<<< END GENERATED FILE (include): SOURCE includer.md -->
```

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
markdown_helper-1.7.0 markdown/use_cases/reuse_text/reuse_text.md