Skip to content

Commit

Permalink
Merge pull request yzane#138 from gnaeus/master
Browse files Browse the repository at this point in the history
Integrate markdown-it-include plugin
  • Loading branch information
yzane committed Sep 28, 2019
2 parents 9f8c53e + 61f9a2a commit c2be1aa
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.md
Expand Up @@ -29,6 +29,7 @@ Supports the following features
* [emoji](http://www.webpagefx.com/tools/emoji-cheat-sheet/)
* [markdown-it-checkbox](https://github.com/mcecot/markdown-it-checkbox)
* [markdown-it-container](https://github.com/markdown-it/markdown-it-container)
* [markdown-it-include](https://github.com/camelaissani/markdown-it-include)
* [PlantUML](http://plantuml.com/)
* [markdown-it-plantuml](https://github.com/gmunguia/markdown-it-plantuml)

Expand Down Expand Up @@ -68,6 +69,34 @@ OUTPUT

![PlantUML](images/PlantUML.png)

### markdown-it-include

Include markdown fragment files: `:[alternate-text](relative-path-to-file.md)`.

```
├── [plugins]
│ └── README.md
├── CHANGELOG.md
└── README.md
```

INPUT
```
README Content
:[Plugins](./plugins/README.md)
:[Changelog](CHANGELOG.md)
```

OUTPUT
```
Content of README.md
Content of plugins/README.md
Content of CHANGELOG.md
```

## Install

Expand Down
9 changes: 9 additions & 0 deletions extension.js
Expand Up @@ -266,6 +266,15 @@ function convertMarkdownToHtml(filename, type, text) {
}
md.use(require('markdown-it-plantuml'), plantumlOptions);

// markdown-it-include
// https://github.com/camelaissani/markdown-it-include
// the syntax is :[alt-text](relative-path-to-file.md)
// https://talk.commonmark.org/t/transclusion-or-including-sub-documents-for-reuse/270/13
md.use(require("markdown-it-include"), {
root: path.dirname(filename),
includeRe: /\:(?:\[[^\]]*\])?\(([^)]+\.md)\)/i
});

statusbarmessage.dispose();
return md.render(text);

Expand Down
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -475,6 +475,7 @@
"markdown-it-checkbox": "^1.1.0",
"markdown-it-container": "^2.0.0",
"markdown-it-emoji": "^1.4.0",
"markdown-it-include": "^1.1.0",
"markdown-it-named-headers": "0.0.4",
"markdown-it-plantuml": "^1.4.1",
"mkdirp": "^0.5.1",
Expand Down

0 comments on commit c2be1aa

Please sign in to comment.