Sha256: ec9ee411eb823a988c33afff5d95a9906afc262738c6f46b3f109d3fd3885e9e

Contents?: true

Size: 1.34 KB

Versions: 4

Compression:

Stored size: 1.34 KB

Contents

### Create and Include Page TOC

1.  Maintain markdown text in a separate file.
2.  Create a table of contents for the text.
3.  Use an includer file to include the contents and the text.

#### Text File

It's big, so linking instead of including:  [text file](text.md#lorem-ipsum).

#### Includer File

```includer.md```:
```markdown
### Page Contents
        
@[:markdown](toc.md)

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

#### CLI

You can use the command-line interface to perform the creation and inclusion.

##### Command

```create_and_include.sh```:
```sh
# Option --pristine suppresses comment insertion.
markdown_helper create_page_toc --pristine text.md toc.md
markdown_helper include --pristine includer.md page.md
```

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

#### API

You can use the API to perform the creation and inclusion.

##### Ruby Code

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

# Option :printine suppresses the addition of comments.
markdown_helper = MarkdownHelper.new(:pristine => true)
markdown_helper.create_page_toc('text.md', 'toc.md')
markdown_helper.include('includer.md', 'page.md')
```

##### Command

```sh
ruby create_and_include.rb
```

### Finished Page
            
It's big, so linking instead of including:  [page file](page.md#page-contents).

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
markdown_helper-2.1.0 markdown/use_cases/tables_of_contents/create_and_include_page_toc/use_case.md
markdown_helper-2.0.0 markdown/use_cases/tables_of_contents/create_and_include_page_toc/use_case.md
markdown_helper-1.9.9 markdown/use_cases/tables_of_contents/create_and_include_page_toc/use_case.md
markdown_helper-1.9.5 markdown/use_cases/tables_of_contents/create_and_include_page_toc/use_case.md