Skip to content

Commit

Permalink
Merge branch 'release/1.1.0' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
yzane committed May 3, 2018
2 parents 72a38be + d5e4837 commit 4edece4
Show file tree
Hide file tree
Showing 6 changed files with 167 additions and 344 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change Log

## 1.1.0 (2018/05/03)
* Add: Support [markdown-it-container](https://github.com/markdown-it/markdown-it-container) [#72](https://github.com/yzane/vscode-markdown-pdf/issues/72)

## 1.0.5 (2018/05/03)
* Improve: Exception handling
* Improve: Chromium install check
Expand Down
22 changes: 21 additions & 1 deletion README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,31 @@
以下の機能をサポートしています。
* [Syntax highlighting](https://highlightjs.org/static/demo/)
* [emoji](http://www.webpagefx.com/tools/emoji-cheat-sheet/)
* checkbox
* [markdown-it-checkbox](https://github.com/mcecot/markdown-it-checkbox)
* [markdown-it-container](https://github.com/markdown-it/markdown-it-container)

サンプルファイル
* [pdf](sample/README.pdf)
* [html](sample/README.html)
* [png](sample/README.png)
* [jpeg](sample/README.jpeg)

### markdown-it-container

input
```
::: warning
*here be dragons*
:::
```

output
``` html
<div class="warning">
<p><em>here be dragons</em></p>
</div>
```


## インストール

Expand Down Expand Up @@ -491,6 +508,9 @@ Visual Studio Code の `files.autoGuessEncoding` オプションを使うと、

## [Release Notes](CHANGELOG.md)

### 1.1.0 (2018/05/03)
* Add: Support [markdown-it-container](https://github.com/markdown-it/markdown-it-container) [#72](https://github.com/yzane/vscode-markdown-pdf/issues/72)

### 1.0.5 (2018/05/03)
* Improve: Exception handling
* Improve: Chromium install check
Expand Down
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,31 @@ This extension convert Markdown file to pdf, html, png or jpeg file.
Supports the following features
* [Syntax highlighting](https://highlightjs.org/static/demo/)
* [emoji](http://www.webpagefx.com/tools/emoji-cheat-sheet/)
* checkbox
* [markdown-it-checkbox](https://github.com/mcecot/markdown-it-checkbox)
* [markdown-it-container](https://github.com/markdown-it/markdown-it-container)

Sample files
* [pdf](sample/README.pdf)
* [html](sample/README.html)
* [png](sample/README.png)
* [jpeg](sample/README.jpeg)

### markdown-it-container

input
```
::: warning
*here be dragons*
:::
```

output
``` html
<div class="warning">
<p><em>here be dragons</em></p>
</div>
```


## Install

Expand Down Expand Up @@ -497,6 +514,9 @@ Please use the following to insert a page break.

## [Release Notes](CHANGELOG.md)

### 1.1.0 (2018/05/03)
* Add: Support [markdown-it-container](https://github.com/markdown-it/markdown-it-container) [#72](https://github.com/yzane/vscode-markdown-pdf/issues/72)

### 1.0.5 (2018/05/03)
* Improve: Exception handling
* Improve: Chromium install check
Expand Down
16 changes: 16 additions & 0 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,26 @@ function convertMarkdownToHtml(filename, type, text) {
}
md.use(require('markdown-it-named-headers'), options);

// markdown-it-container
// https://github.com/markdown-it/markdown-it-container
md.use(require('markdown-it-container'), '', {
validate: function (name) {
return name.trim().length;
},
render: function (tokens, idx) {
if (tokens[idx].info.trim() !== '') {
return `<div class="${tokens[idx].info.trim()}">\n`;
} else {
return `</div>\n`;
}
}
});

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

} catch (error) {
statusbarmessage.dispose();
showErrorMessage('convertMarkdownToHtml()', error);
}
}
Expand Down
Loading

0 comments on commit 4edece4

Please sign in to comment.