From 62b10a57cedb423f664c866bfd7ac4b757813d73 Mon Sep 17 00:00:00 2001 From: yzane Date: Mon, 30 Sep 2019 01:23:24 +0900 Subject: [PATCH 1/6] Add: Support markdown-it-include --- CHANGELOG.md | 9 +++++++-- README.ja.md | 37 ++++++++++++++++++++++++++++++++----- README.md | 8 +++----- 3 files changed, 42 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7619b09..3b2aec3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,13 @@ # Change Log +## 1.3.0 (2019/09/28) +* Add: Support [markdown-it-include](https://github.com/camelaissani/markdown-it-include) + * Integrate markdown-it-include plugin [#138](https://github.com/yzane/vscode-markdown-pdf/pull/138) +* Update: README + ## 1.2.1 (2019/09/23) -* Fix: [fix typo, grammar](https://github.com/yzane/vscode-markdown-pdf/pull/122) -* Add: [Option to specify the plantuml delimiter](https://github.com/yzane/vscode-markdown-pdf/pull/104) +* Fix: fix typo, grammar [#122](https://github.com/yzane/vscode-markdown-pdf/pull/122) +* Add: Option to specify the plantuml delimiter [#104](https://github.com/yzane/vscode-markdown-pdf/pull/104) * Update: dependencies packages * Update: README * Delete the description of the obsolete options. diff --git a/README.ja.md b/README.ja.md index 30eaf30..9559289 100644 --- a/README.ja.md +++ b/README.ja.md @@ -27,6 +27,7 @@ * [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) @@ -66,6 +67,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 +``` ## インストール @@ -504,12 +533,10 @@ Visual Studio Code の `files.autoGuessEncoding` オプションを使うと、 ## [Release Notes](CHANGELOG.md) -### 1.2.1 (2019/09/23) -* Fix: [fix typo, grammar](https://github.com/yzane/vscode-markdown-pdf/pull/122) -* Add: [Option to specify the plantuml delimiter](https://github.com/yzane/vscode-markdown-pdf/pull/104) -* Update: dependencies packages +### 1.3.0 (2019/09/28) +* Add: Support [markdown-it-include](https://github.com/camelaissani/markdown-it-include) + * Integrate markdown-it-include plugin [#138](https://github.com/yzane/vscode-markdown-pdf/pull/138) * Update: README - * Delete the description of the obsolete options. ## License diff --git a/README.md b/README.md index cf42cba..23e43f6 100644 --- a/README.md +++ b/README.md @@ -539,12 +539,10 @@ Please use the following to insert a page break. ## [Release Notes](CHANGELOG.md) -### 1.2.1 (2019/09/23) -* Fix: [fix typo, grammar](https://github.com/yzane/vscode-markdown-pdf/pull/122) -* Add: [Option to specify the plantuml delimiter](https://github.com/yzane/vscode-markdown-pdf/pull/104) -* Update: dependencies packages +### 1.3.0 (2019/09/28) +* Add: Support [markdown-it-include](https://github.com/camelaissani/markdown-it-include) + * Integrate markdown-it-include plugin [#138](https://github.com/yzane/vscode-markdown-pdf/pull/138) * Update: README - * Delete the description of the obsolete options. ## License From 530d5585188f9a60a253f95c46eed0541209a96e Mon Sep 17 00:00:00 2001 From: yzane Date: Mon, 30 Sep 2019 01:28:39 +0900 Subject: [PATCH 2/6] Add: Support markdown-it-include --- README.ja.md | 1 + README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/README.ja.md b/README.ja.md index 9559289..5d54d34 100644 --- a/README.ja.md +++ b/README.ja.md @@ -556,6 +556,7 @@ MIT * [janl/mustache.js](https://github.com/janl/mustache.js) * [markdown-it/markdown-it-container](https://github.com/markdown-it/markdown-it-container) * [gmunguia/markdown-it-plantuml](https://github.com/gmunguia/markdown-it-plantuml) +* [camelaissani/markdown-it-include](https://github.com/camelaissani/markdown-it-include) and diff --git a/README.md b/README.md index 23e43f6..026db57 100644 --- a/README.md +++ b/README.md @@ -562,6 +562,7 @@ MIT * [janl/mustache.js](https://github.com/janl/mustache.js) * [markdown-it/markdown-it-container](https://github.com/markdown-it/markdown-it-container) * [gmunguia/markdown-it-plantuml](https://github.com/gmunguia/markdown-it-plantuml) +* [camelaissani/markdown-it-include](https://github.com/camelaissani/markdown-it-include) and From c8ee309624ff1057736566f0ff649c1a84260cba Mon Sep 17 00:00:00 2001 From: yzane Date: Mon, 30 Sep 2019 02:25:23 +0900 Subject: [PATCH 3/6] Add: markdown-pdf.markdown-it-include.enable option --- CHANGELOG.md | 1 + README.ja.md | 8 ++++++++ README.md | 8 ++++++++ extension.js | 10 ++++++---- package.json | 5 +++++ 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b2aec3..2e54512 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## 1.3.0 (2019/09/28) * Add: Support [markdown-it-include](https://github.com/camelaissani/markdown-it-include) * Integrate markdown-it-include plugin [#138](https://github.com/yzane/vscode-markdown-pdf/pull/138) + * Add: `markdown-pdf.markdown-it-include.enable` option * Update: README ## 1.2.1 (2019/09/23) diff --git a/README.ja.md b/README.ja.md index 5d54d34..2bd757d 100644 --- a/README.ja.md +++ b/README.ja.md @@ -197,6 +197,7 @@ Markdown PDF をインストールして、Visutal Studio Code で Markdownフ ||[markdown-pdf.omitBackground](#markdown-pdfomitbackground)| |[PlantUML options](#plantuml-options)|[markdown-pdf.plantumlOpenMarker](#markdown-pdfplantumlopenmarker)| ||[markdown-pdf.plantumlCloseMarker](#markdown-pdfplantumlclosemarker)| +|[markdown-it-include options](#markdown-it-include-options)|[markdown-pdf.markdown-it-include.enable](#markdown-pdfmarkdown-it-includeenable)| ### Save options @@ -482,6 +483,12 @@ Markdown PDF をインストールして、Visutal Studio Code で Markdownフ - plantuml パーサーの終了区切り文字 - Default: @enduml +### markdown-it-include options + +#### `markdown-pdf.markdown-it-include.enable` + - markdown-it-include を有効にします + - boolean. Default: true +
## FAQ @@ -536,6 +543,7 @@ Visual Studio Code の `files.autoGuessEncoding` オプションを使うと、 ### 1.3.0 (2019/09/28) * Add: Support [markdown-it-include](https://github.com/camelaissani/markdown-it-include) * Integrate markdown-it-include plugin [#138](https://github.com/yzane/vscode-markdown-pdf/pull/138) + * Add: `markdown-pdf.markdown-it-include.enable` option * Update: README diff --git a/README.md b/README.md index 026db57..7524063 100644 --- a/README.md +++ b/README.md @@ -200,6 +200,7 @@ If the download is not successful or you want to avoid downloading every time yo ||[markdown-pdf.omitBackground](#markdown-pdfomitbackground)| |[PlantUML options](#plantuml-options)|[markdown-pdf.plantumlOpenMarker](#markdown-pdfplantumlopenmarker)| ||[markdown-pdf.plantumlCloseMarker](#markdown-pdfplantumlclosemarker)| +|[markdown-it-include options](#markdown-it-include-options)|[markdown-pdf.markdown-it-include.enable](#markdown-pdfmarkdown-it-includeenable)| ### Save options @@ -488,6 +489,12 @@ If the download is not successful or you want to avoid downloading every time yo - Closing delimiter used for the plantuml parser. - Default: @enduml +### markdown-it-include options + +#### `markdown-pdf.markdown-it-include.enable` + - Enable markdown-it-include. + - boolean. Default: true +
## FAQ @@ -542,6 +549,7 @@ Please use the following to insert a page break. ### 1.3.0 (2019/09/28) * Add: Support [markdown-it-include](https://github.com/camelaissani/markdown-it-include) * Integrate markdown-it-include plugin [#138](https://github.com/yzane/vscode-markdown-pdf/pull/138) + * Add: `markdown-pdf.markdown-it-include.enable` option * Update: README diff --git a/extension.js b/extension.js index be3ce93..38867cb 100644 --- a/extension.js +++ b/extension.js @@ -270,10 +270,12 @@ function convertMarkdownToHtml(filename, type, text) { // 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 - }); + if (vscode.workspace.getConfiguration('markdown-pdf')['markdown-it-include']['enable']) { + md.use(require("markdown-it-include"), { + root: path.dirname(filename), + includeRe: /\:(?:\[[^\]]*\])?\(([^)]+\.md)\)/i + }); + } statusbarmessage.dispose(); return md.render(text); diff --git a/package.json b/package.json index 2e657ba..d928a45 100644 --- a/package.json +++ b/package.json @@ -455,6 +455,11 @@ "type": "number", "default": 10000, "description": "Statusbar message timeout [milliseconds]" + }, + "markdown-pdf.markdown-it-include.enable": { + "type": "boolean", + "default": true, + "description": "Enable markdown-it-include. " } } } From 1b42c0108d0f71fb2114f20c88ba024b2dd761d0 Mon Sep 17 00:00:00 2001 From: yzane Date: Mon, 30 Sep 2019 02:42:02 +0900 Subject: [PATCH 4/6] Add: delete sample/README.* --- src/compile.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compile.js b/src/compile.js index c72e4f7..dbb0995 100644 --- a/src/compile.js +++ b/src/compile.js @@ -9,6 +9,7 @@ var removeNPMAbsolutePaths = require('removeNPMAbsolutePaths'); console.log('delete file...'); deleteFile(path.join(__dirname, '..', 'node_modules', 'emoji-images', 'json')); deleteFile(path.join(__dirname, '..', 'node_modules', 'puppeteer', '.local-chromium')); +deleteFile(path.join(__dirname, '..', 'sample', 'README.*')); removeNPMAbsolutePaths(path.join(__dirname, '..', 'node_modules'), { force: true, fields: ['_where', '_args']}) .then(results => results.forEach(result => { From 61b2688d24e2144b8372aa680d88be1823f9234c Mon Sep 17 00:00:00 2001 From: yzane Date: Mon, 30 Sep 2019 02:59:11 +0900 Subject: [PATCH 5/6] Update: sample files --- sample/README.html | 44 ++++++++++++++++++++++++++++++++++++++------ sample/README.jpeg | Bin 1944551 -> 2051620 bytes sample/README.pdf | Bin 534887 -> 539558 bytes sample/README.png | Bin 722441 -> 756497 bytes 4 files changed, 38 insertions(+), 6 deletions(-) diff --git a/sample/README.html b/sample/README.html index 42723dc..709fd73 100644 --- a/sample/README.html +++ b/sample/README.html @@ -411,6 +411,7 @@

Features

  • emoji
  • markdown-it-checkbox
  • markdown-it-container
  • +
  • markdown-it-include
  • PlantUML
  • OUTPUT

    PlantUML

    +

    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

    Chromium download starts automatically when Markdown PDF is installed and Markdown file is first opened with Visutal Studio Code.

    However, it is time-consuming depending on the environment because of its large size (~ 170Mb Mac, ~ 282Mb Linux, ~ 280Mb Win).

    @@ -649,6 +671,10 @@

    List

    markdown-pdf.plantumlCloseMarker + +markdown-it-include options +markdown-pdf.markdown-it-include.enable +

    Save options

    @@ -941,6 +967,12 @@

    markdown-pdf.plantumlCloseMarker<
  • Closing delimiter used for the plantuml parser.
  • Default: @enduml
  • +

    markdown-it-include options

    +

    markdown-pdf.markdown-it-include.enable

    +
      +
    • Enable markdown-it-include.
    • +
    • boolean. Default: true
    • +

    FAQ

    How can I change emoji size ?

    @@ -972,16 +1004,15 @@

    markdown-pdf.styles option

  • Online CSS (https://xxx/xxx.css) is applied correctly for JPG and PNG, but problems occur with PDF. #67
  • Release Notes

    -

    1.2.1 (2019/09/23)

    +

    1.3.0 (2019/09/28)

    License

    MIT

    @@ -998,6 +1029,7 @@

    Special thanks

  • janl/mustache.js
  • markdown-it/markdown-it-container
  • gmunguia/markdown-it-plantuml
  • +
  • camelaissani/markdown-it-include
  • and