Sha256: 714a4fff92147bfa2c2a03b757ccf221c9accc333aa7d0ed4a20a356c7fcf345

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 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

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

<code>reusable_text.md</code>
```markdown
This is some reusable 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>
```markdown
This file includes the useful text.

@[:markdown](reusable_text.md)

Then includes it again.

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

#### Command

Here's the command to perform the inclusion:

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

(Option ```--pristine``` suppresses comment insertion.)

#### File with Inclusion

Here's the finished file with the inclusion:

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

This is some reusable text that can be included in more than one place (actually, in more than one file).

Then includes it again.

This is some reusable text that can be included in more than one place (actually, in more than one file).
```

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
markdown_helper-1.8.0 markdown/use_cases/include/reuse_text/reuse_text.md