markdown-it-include
Advanced tools
Comparing version 0.0.2 to 1.0.0
@@ -9,5 +9,4 @@ 'use strict'; | ||
module.exports = function include_plugin(md, basedir) { | ||
var filesProcessed; | ||
function _replaceIncludeByContent(src, rootdir, parentFilePath) { | ||
function _replaceIncludeByContent(src, rootdir, parentFilePath, filesProcessed) { | ||
filesProcessed = filesProcessed ? filesProcessed.slice() : []; // making a copy | ||
var cap, filePath, mdSrc, indexOfCircularRef; | ||
@@ -29,3 +28,4 @@ | ||
// replace include by file content | ||
mdSrc = _replaceIncludeByContent(fs.readFileSync(filePath, 'utf8'), path.dirname(filePath), filePath); | ||
mdSrc = fs.readFileSync(filePath, 'utf8'); | ||
mdSrc = _replaceIncludeByContent(mdSrc, path.dirname(filePath), filePath, filesProcessed); | ||
src = src.slice(0, cap.index) + mdSrc + src.slice(cap.index + cap[0].length, src.length); | ||
@@ -38,3 +38,2 @@ } | ||
var rootdir = basedir || '.'; | ||
filesProcessed = []; | ||
state.src = _replaceIncludeByContent(state.src, rootdir); | ||
@@ -41,0 +40,0 @@ } |
{ | ||
"name": "markdown-it-include", | ||
"version": "0.0.2", | ||
"version": "1.0.0", | ||
"description": "Markdown-it plugin which adds the ability to include markdown fragment files.", | ||
@@ -24,18 +24,18 @@ "keywords": [ | ||
"author": { | ||
"name" : "Camel Aissani", | ||
"email" : "camel.aissani@gmail.com", | ||
"url" : "https://nuageprive.fr/" | ||
"name": "Camel Aissani", | ||
"email": "camel.aissani@gmail.com", | ||
"url": "https://nuageprive.fr/" | ||
}, | ||
"devDependencies": { | ||
"eslint": "0.10.2", | ||
"eslint-plugin-nodeca": "^1.0.0", | ||
"browserify": "*", | ||
"browserify": "^14.5.0", | ||
"chai": "^4.1.2", | ||
"coveralls": "^2.11.2", | ||
"uglify-js": "*", | ||
"istanbul": "*", | ||
"chai": "*", | ||
"mocha": "*", | ||
"markdown-it-testgen": "~0.1.0", | ||
"markdown-it": "markdown-it/markdown-it" | ||
"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" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
20698
2