{"_id":"markdown-it-include","_rev":"439953","name":"markdown-it-include","description":"Markdown-it plugin which adds the ability to include markdown fragment files.","dist-tags":{"latest":"2.0.0"},"maintainers":[{"name":"camelaissani","email":"camel.aissani@gmail.com"}],"time":{"modified":"2021-08-05T06:31:38.000Z","created":"2016-04-23T11:29:49.589Z","2.0.0":"2020-09-05T20:09:04.893Z","1.1.1":"2020-05-15T15:24:32.521Z","1.1.0":"2019-02-20T22:49:21.546Z","1.0.1":"2019-02-16T14:48:53.714Z","1.0.0":"2017-12-15T10:17:16.839Z","0.0.2":"2016-04-23T21:28:47.810Z","0.0.1":"2016-04-23T11:29:49.589Z"},"users":{"codevinsky":true},"author":{"name":"Camel Aissani","email":"camel.aissani@gmail.com","url":"https://nuageprive.fr/"},"repository":{"type":"git","url":"git+https://github.com/camelaissani/markdown-it-include.git"},"versions":{"2.0.0":{"name":"markdown-it-include","version":"2.0.0","description":"Markdown-it plugin which adds the ability to include markdown fragment files.","keywords":["markdown-it-plugin","markdown-it","markdown","include"],"repository":{"type":"git","url":"git+https://github.com/camelaissani/markdown-it-include.git"},"bugs":{"url":"https://github.com/camelaissani/markdown-it-include/issues"},"license":"MIT","source":"index.js","main":"dist/markdownItInclude.js","module":"dist/markdownItInclude.mjs","author":{"name":"Camel Aissani","email":"camel.aissani@gmail.com","url":"https://nuageprive.fr/"},"peerDependencies":{"markdown-it":">=8.4.2"},"devDependencies":{"chai":"4.2.0","coveralls":"3.1.0","cross-env":"7.0.2","eslint":"7.3.1","glob":"7.1.6","markdown-it":"11.0.0","markdown-it-testgen":"0.1.6","microbundle":"0.12.2","mocha":"8.1.3","nyc":"15.1.0","prepend-file":"2.0.0"},"reporter":["lcov","text","text-summary"],"engines":{"node":">=10"},"scripts":{"build":"make","test":"make test","todo":"make todo","clean":"make clean","superclean":"make superclean","doc":"make doc","lint":"make lint","lintfix":"make lintfix","cov":"make report-coverage"},"gitHead":"def47e99e9a5a37b080ab210d6a853af61266362","homepage":"https://github.com/camelaissani/markdown-it-include#readme","_id":"markdown-it-include@2.0.0","_nodeVersion":"12.18.3","_npmVersion":"6.14.6","dist":{"shasum":"e86e3b3c68c8f0e0437e179ba919ffd28443127a","size":11456,"noattachment":false,"key":"/markdown-it-include/-/markdown-it-include-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/markdown-it-include/download/markdown-it-include-2.0.0.tgz"},"maintainers":[{"name":"camelaissani","email":"camel.aissani@gmail.com"}],"_npmUser":{"name":"camelaissani","email":"camel.aissani@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/markdown-it-include_2.0.0_1599336544742_0.3745878092091972"},"_hasShrinkwrap":false,"publish_time":1599336544893,"_cnpm_publish_time":1599336544893},"1.1.1":{"name":"markdown-it-include","version":"1.1.1","description":"Markdown-it plugin which adds the ability to include markdown fragment files.","keywords":["markdown-it-plugin","markdown-it","markdown","include"],"repository":{"type":"git","url":"git+https://github.com/camelaissani/markdown-it-include.git"},"bugs":{"url":"https://github.com/camelaissani/markdown-it-include/issues"},"license":"MIT","main":"index.js","scripts":{"test":"make test"},"author":{"name":"Camel Aissani","email":"camel.aissani@gmail.com","url":"https://nuageprive.fr/"},"peerDependencies":{"markdown-it":">=8.4.2 <11.0.0"},"devDependencies":{"browserify":"16.5.1","chai":"4.2.0","coveralls":"3.1.0","eslint":"7.0.0","eslint-plugin-nodeca":"1.0.3","markdown-it":"10.0.0","markdown-it-testgen":"0.1.6","mocha":"7.1.2","nyc":"15.0.1","uglify-js":"3.9.3"},"gitHead":"bf615ae89eb545be6092af34a27fccbc0d7517b3","homepage":"https://github.com/camelaissani/markdown-it-include#readme","_id":"markdown-it-include@1.1.1","_nodeVersion":"12.13.0","_npmVersion":"6.12.0","dist":{"shasum":"7015209f7b64365d32bb6ccc25366bc15d3eadc9","size":9516,"noattachment":false,"key":"/markdown-it-include/-/markdown-it-include-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/markdown-it-include/download/markdown-it-include-1.1.1.tgz"},"maintainers":[{"name":"camelaissani","email":"camel.aissani@gmail.com"}],"_npmUser":{"name":"camelaissani","email":"camel.aissani@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/markdown-it-include_1.1.1_1589556272364_0.7290438174202287"},"_hasShrinkwrap":false,"publish_time":1589556272521,"_cnpm_publish_time":1589556272521},"1.1.0":{"name":"markdown-it-include","version":"1.1.0","description":"Markdown-it plugin which adds the ability to include markdown fragment files.","keywords":["markdown-it-plugin","markdown-it","markdown","include"],"repository":{"type":"git","url":"git+https://github.com/camelaissani/markdown-it-include.git"},"bugs":{"url":"https://github.com/camelaissani/markdown-it-include/issues"},"license":"MIT","main":"index.js","scripts":{"test":"make test"},"author":{"name":"Camel Aissani","email":"camel.aissani@gmail.com","url":"https://nuageprive.fr/"},"devDependencies":{"browserify":"16.2.3","chai":"^4.2.0","coveralls":"3.0.2","eslint":"5.14.0","eslint-plugin-nodeca":"1.0.3","istanbul":"0.4.5","markdown-it":"8.4.2","markdown-it-testgen":"0.1.4","mocha":"5.2.0","uglify-js":"3.4.9"},"gitHead":"1d8fdaf3c19a9103cd895a861a5394d61bd6c849","homepage":"https://github.com/camelaissani/markdown-it-include#readme","_id":"markdown-it-include@1.1.0","_nodeVersion":"8.12.0","_npmVersion":"6.8.0","dist":{"shasum":"c88fff73a97de4ab678da84c69a51de6105f390d","size":8917,"noattachment":false,"key":"/markdown-it-include/-/markdown-it-include-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/markdown-it-include/download/markdown-it-include-1.1.0.tgz"},"maintainers":[{"name":"camelaissani","email":"camel.aissani@gmail.com"}],"_npmUser":{"name":"camelaissani","email":"camel.aissani@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/markdown-it-include_1.1.0_1550702961388_0.9038230069935609"},"_hasShrinkwrap":false,"publish_time":1550702961546,"_cnpm_publish_time":1550702961546},"1.0.1":{"name":"markdown-it-include","version":"1.0.1","description":"Markdown-it plugin which adds the ability to include markdown fragment files.","keywords":["markdown-it-plugin","markdown-it","markdown","inlcude"],"repository":{"type":"git","url":"git+https://github.com/camelaissani/markdown-it-include.git"},"bugs":{"url":"https://github.com/camelaissani/markdown-it-include/issues"},"license":"MIT","main":"index.js","scripts":{"test":"make test"},"author":{"name":"Camel Aissani","email":"camel.aissani@gmail.com","url":"https://nuageprive.fr/"},"devDependencies":{"browserify":"16.2.3","chai":"^4.2.0","coveralls":"3.0.2","eslint":"5.14.0","eslint-plugin-nodeca":"1.0.3","istanbul":"0.4.5","markdown-it":"8.4.2","markdown-it-testgen":"0.1.4","mocha":"5.2.0","uglify-js":"3.4.9"},"gitHead":"eb20d48bcaeda0ba777b26f510b812afb2697dda","homepage":"https://github.com/camelaissani/markdown-it-include#readme","_id":"markdown-it-include@1.0.1","_nodeVersion":"8.12.0","_npmVersion":"6.8.0","dist":{"shasum":"6f7b0933b7e4682523034d77c3aa6eb3324be097","size":8670,"noattachment":false,"key":"/markdown-it-include/-/markdown-it-include-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/markdown-it-include/download/markdown-it-include-1.0.1.tgz"},"maintainers":[{"name":"camelaissani","email":"camel.aissani@gmail.com"}],"_npmUser":{"name":"camelaissani","email":"camel.aissani@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/markdown-it-include_1.0.1_1550328533544_0.7271489604052324"},"_hasShrinkwrap":false,"publish_time":1550328533714,"_cnpm_publish_time":1550328533714},"1.0.0":{"name":"markdown-it-include","version":"1.0.0","description":"Markdown-it plugin which adds the ability to include markdown fragment files.","keywords":["markdown-it-plugin","markdown-it","markdown","inlcude"],"repository":{"type":"git","url":"git+https://github.com/camelaissani/markdown-it-include.git"},"bugs":{"url":"https://github.com/camelaissani/markdown-it-include/issues"},"license":"MIT","main":"index.js","scripts":{"test":"make test"},"author":{"name":"Camel Aissani","email":"camel.aissani@gmail.com","url":"https://nuageprive.fr/"},"devDependencies":{"browserify":"^14.5.0","chai":"^4.1.2","coveralls":"^2.11.2","eslint":"^0.10.2","eslint-plugin-nodeca":"^1.0.3","istanbul":"^0.4.5","markdown-it":"^8.4.0","markdown-it-testgen":"^0.1.4","mocha":"^4.0.1","uglify-js":"^3.2.2"},"gitHead":"b885d5a9bd3349c7f5529fdf5837622a33ee24af","homepage":"https://github.com/camelaissani/markdown-it-include#readme","_id":"markdown-it-include@1.0.0","_npmVersion":"5.5.1","_nodeVersion":"8.9.3","_npmUser":{"name":"camelaissani","email":"camel.aissani@gmail.com"},"dist":{"shasum":"b76b51026d7e5e9c715a77bca464799719346c20","size":7047,"noattachment":false,"key":"/markdown-it-include/-/markdown-it-include-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/markdown-it-include/download/markdown-it-include-1.0.0.tgz"},"maintainers":[{"name":"camelaissani","email":"camel.aissani@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/markdown-it-include-1.0.0.tgz_1513333036069_0.3156740178819746"},"directories":{},"publish_time":1513333036839,"_hasShrinkwrap":false,"_cnpm_publish_time":1513333036839},"0.0.2":{"name":"markdown-it-include","version":"0.0.2","description":"Markdown-it plugin which adds the ability to include markdown fragment files.","keywords":["markdown-it-plugin","markdown-it","markdown","inlcude"],"repository":{"type":"git","url":"git+https://github.com/camelaissani/markdown-it-include.git"},"bugs":{"url":"https://github.com/camelaissani/markdown-it-include/issues"},"license":"MIT","main":"index.js","scripts":{"test":"make test"},"author":{"name":"Camel Aissani","email":"camel.aissani@gmail.com","url":"https://nuageprive.fr/"},"devDependencies":{"eslint":"0.10.2","eslint-plugin-nodeca":"^1.0.0","browserify":"*","coveralls":"^2.11.2","uglify-js":"*","istanbul":"*","chai":"*","mocha":"*","markdown-it-testgen":"~0.1.0","markdown-it":"github:markdown-it/markdown-it"},"gitHead":"d2e354dd3b7aad2e7670a311244f486d36081209","homepage":"https://github.com/camelaissani/markdown-it-include#readme","_id":"markdown-it-include@0.0.2","_shasum":"0be985e309289fb264c561e017857555cf7fbfec","_from":".","_npmVersion":"2.15.1","_nodeVersion":"4.4.3","_npmUser":{"name":"camelaissani","email":"camel.aissani@gmail.com"},"dist":{"shasum":"0be985e309289fb264c561e017857555cf7fbfec","size":6997,"noattachment":false,"key":"/markdown-it-include/-/markdown-it-include-0.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/markdown-it-include/download/markdown-it-include-0.0.2.tgz"},"maintainers":[{"name":"camelaissani","email":"camel.aissani@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/markdown-it-include-0.0.2.tgz_1461446925879_0.1514989600982517"},"directories":{},"publish_time":1461446927810,"_cnpm_publish_time":1461446927810,"_hasShrinkwrap":false},"0.0.1":{"name":"markdown-it-include","version":"0.0.1","description":"Markdown-it plugin which adds the ability to include markdown fragment files.","keywords":["markdown-it-plugin","markdown-it","markdown","inlcude"],"repository":{"type":"git","url":"git+https://github.com/camelaissani/markdown-it-include.git"},"bugs":{"url":"https://github.com/camelaissani/markdown-it-include/issues"},"license":"MIT","main":"index.js","scripts":{"test":"make test"},"devDependencies":{"eslint":"0.10.2","eslint-plugin-nodeca":"^1.0.0","browserify":"*","coveralls":"^2.11.2","uglify-js":"*","istanbul":"*","chai":"*","mocha":"*","markdown-it-testgen":"~0.1.0","markdown-it":"github:markdown-it/markdown-it"},"gitHead":"47990e29f04349cc3c6f3f2f486716ffbb55b97c","homepage":"https://github.com/camelaissani/markdown-it-include#readme","_id":"markdown-it-include@0.0.1","_shasum":"f4e117db2ce1cc590e5fb0c1d1cc758135eb0388","_from":".","_npmVersion":"2.15.1","_nodeVersion":"4.4.3","_npmUser":{"name":"camelaissani","email":"camel.aissani@gmail.com"},"dist":{"shasum":"f4e117db2ce1cc590e5fb0c1d1cc758135eb0388","size":6720,"noattachment":false,"key":"/markdown-it-include/-/markdown-it-include-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/markdown-it-include/download/markdown-it-include-0.0.1.tgz"},"maintainers":[{"name":"camelaissani","email":"camel.aissani@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/markdown-it-include-0.0.1.tgz_1461410987272_0.6856272050645202"},"directories":{},"publish_time":1461410989589,"_cnpm_publish_time":1461410989589,"_hasShrinkwrap":false}},"readme":"# markdown-it-include\n\n[![Build Status](https://img.shields.io/travis/camelaissani/markdown-it-include/master.svg?style=flat)](https://travis-ci.org/camelaissani/markdown-it-include)\n[![NPM version](https://img.shields.io/npm/v/markdown-it-include.svg?style=flat)](https://www.npmjs.org/package/markdown-it-include)\n[![Coverage Status](https://img.shields.io/coveralls/camelaissani/markdown-it-include/master.svg?style=flat)](https://coveralls.io/r/camelaissani/markdown-it-include?branch=master)\n\nMarkdown-it plugin which adds the ability to include markdown fragment files.\n\n## Install\n\nnode.js, browser:\n\n```bash\nnpm install markdown-it-include --save\nbower install markdown-it-include --save\n```\n\n## Use\n\nLet's create a markdown which uses a header and a footer from two separate files:\n\n### File: '**header.md**'\n\n```markdown\n# This is my header for all my markdowns\n```\n\n### File: '**footer.md**'\n\n```markdown\nFollow me on twitter!\n```\n\nLet's assume that header.md and footer.md are located in `/in/this/directory`.\n\nNow it's your turn to play markdown-it!\n\n```js\nvar md = require('markdown-it')()\n            .use(require('markdown-it-include'), '/in/this/directory');\n\nmd.render('!!!include(header.md)!!!\\n\\n*your content*\\n\\n!!!include(footer.md)!!!');\n```\n\nIt will produce this\n\n```html\n<h1>This is my header for all my markdowns</h1>\n<p><em>your content</em></p>\n<p>Follow me on twitter!</p>\n```\n\n## Options\n\n```js\nvar md = require('markdown-it')()\n            .use(require('markdown-it-include'), options);\n```\n\n* Options Type: `String|Object`\n\nIf it's a string, it's the same as `options.root`.\n\nOtherwise, it must be an options object (or `null` / `undefined` when you only wish to use the default options).\n\nThe options object may contain any of these:\n\n### root\n\n* Type: `String`\n* Default: `.`\n\n`root` is the base directory of all the markdown files.\n\n### get RootDir\n\n* Type: `Function`\n* Default: `(options, state, startLine, endLine) => options.root`\n\n`getRootDir()` can be used to customize the root directory used for the includes in a very flexible way.\n\nHere's an example where the root directory for the relative paths in the MarkDown is set to the directory the currently parsed MarkDown file is located in. Note that by setting this callback in the `state.env` state environment, we can have multiple different functions for multiple parse actions in parallel -- ahandy thing to have when we process the MarkDown content asynchronously, for example!\n\n```js\n// md instance setup:\nconst options = {\n  root: '/bogus/',\n  // show the\n  getRootDir: (options, state, startLine, endLine) =>\n      state.env.getIncludeRootDir(options, state, startLine, endLine),\n  bracesAreOptional: true\n};\n\nlet md = require('markdown-it')()\n           .use(require('markdown-it-include'), options);\n\n...\n\n// now in some async code rendering multiple MD files, we can do this:\n\n// (`mdPath` is an absolute path pointing to the MD file being processed)\nlet mdPath = ...;\n\nlet env = {};\nenv.getIncludeRootDir = function (options, state, startLine, endLine) {\n  return path.dirname(mdPath);\n};\n\n// Use the 'unwrapped' version of the md.render / md.parse process:\n//\n// let content = md.render(data); --> .parse + .renderer.render\n//\n// .parse --> new state + process: return tokens\n// let tokens = md.parse(data, env)\nlet state = new md.core.State(data, md, env);   // <-- here our env is injected into state!\nmd.core.process(state);\nlet tokens = state.tokens;\n// now call md.render():\nlet htmlContent = md.renderer.render(tokens, md.options, env);\n// presto!              (End of `env` lifetime, BTW.)\n```\n\n### includeRe\n\n* Type: `RegExp`\n* Default: `/\\!{3}\\s*include(.+?)\\!{3}/i`\n\nBy default the `!!!include(path)!!!` statement is used to include markdown fragment files. This option allows to change the regular expression and then customize this statement.\n\n### bracesAreOptional\n\n* Type: `Boolean`\n* Default: `false`\n\nWhen set to TRUE, this option allows users to write include statements like `!!!include path !!!` instead of ``!!!include(path)!!!`. Note that when this option is set, both these forms are acceptable.\n\n> This allows you to configure the plugin to use C/C++ like `#include` statements in your MarkDown if you're so inclined -- I know I am! :)\n\nExample usage:\n\n```js\nconst options = {\n  includeRe: /#include(.+)/,\n  bracesAreOptional: true\n};\n\nlet md = require('markdown-it')()\n           .use(require('markdown-it-include'), options);\nlet html = md.render('#include(xyz.md)\\n');\n```\n\n### throwError\n\n* Type: `Boolean`\n* Default: `true`\n\nWhen set to `false`, instead of throwing an error message, the error message will be written into the output. For references to possible error messages as well as how to change it, see options 'notFoundMessage' and 'circularMessage'.\n\nError messages will always be prefixed with the text `\"INCLUDE ERROR:\"` and will be rendered as `<h1>` headings wheenever possible so they will be pretty obvious in the generated output when they occur. After all, you don't want errors to silently hide under the rug.\n\n### notFoundMessage\n\n* Type: `String`\n* Default: `File '{{FILE}}' not found.`\n\nWith `notFoundMessage` the default error message when the to be included file cannot be found can be changed. The marker `{{FILE}}` in the message string will be replaced with the full file path.\n\n### circularMessage\n\n* Type: `String`\n* Default: `Circular reference between '{{FILE}}' and '{{PARENT}}'.`\n\nWith `circularMessage` the default error message when there is a circular reference between files can be changed. The markers `{{FILE}}` and `{{FILE}}` in the message string will be replaced with the respective full file paths.\n\n\n## Disclaimer\n\nThis purposefully doesn't conform to any spec or discussion related to CommonMark.\n\n## License\n\n[MIT](https://github.com/camelaissani/markdown-it-include/LICENSE)\n","_attachments":{},"homepage":"https://github.com/camelaissani/markdown-it-include#readme","bugs":{"url":"https://github.com/camelaissani/markdown-it-include/issues"},"license":"MIT"}