markdown-magic
Advanced tools
Comparing version 0.1.21 to 0.1.22
@@ -71,3 +71,4 @@ "use strict" // eslint-disable-line | ||
transformsFound.push({ | ||
transform: commentMatches[1], | ||
spaces: commentMatches[1], // Preserve indentation | ||
transform: commentMatches[2], | ||
match: match[matchIndex] | ||
@@ -91,3 +92,8 @@ }) | ||
const newContent = updateContents(element.match, mergedConfig) | ||
content = content.replace(element.match, newContent) | ||
const firstLineIndentation = element.spaces | ||
const contentWithIndentation = newContent.split('\n').join(`\n` + element.spaces) | ||
const preserveTabs = `${firstLineIndentation}${contentWithIndentation}` | ||
content = content.replace(element.match, preserveTabs) | ||
mergedConfig.outputContent = content | ||
@@ -94,0 +100,0 @@ }) |
@@ -5,3 +5,3 @@ "use strict" // eslint-disable-line | ||
//return new RegExp(`(?:\\<\\!--(?:.|\\r?\\n)*?${matchWord}:START(?:.|\\r?\\n)*?\\()(.*)\\)(?:.|\\r?\\n)*?<!--(?:.|\\r?\\n)*?${matchWord}:END(?:.|\\r?\\n)*?--\\>`, 'g') | ||
return new RegExp(`(?:\\<\\!--(?:.*|\r?|\n?|\s*)${matchWord}:START(?:.|\\r?\\n)*?\\()(.*)\\)(?:.|\\r?\\n)*?<!--(?:.*|\r?|\n?|\s*)${matchWord}:END(?:.|\\r?\\n)*?--\\>`, 'g') | ||
return new RegExp(`(.*)(?:\\<\\!--(?:.*|\r?|\n?|\s*)${matchWord}:START(?:.|\\r?\\n)*?\\()(.*)\\)(?:.|\\r?\\n)*?<!--(?:.*|\r?|\n?|\s*)${matchWord}:END(?:.|\\r?\\n)*?--\\>`, 'g') | ||
} | ||
@@ -8,0 +8,0 @@ |
{ | ||
"name": "markdown-magic", | ||
"version": "0.1.21", | ||
"version": "0.1.22", | ||
"description": "Automatically update markdown files with content from external sources", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -7,3 +7,3 @@ # Markdown Magic [![npm-version][npm-badge]][npm-link] | ||
<img align="right" width="200" height="183" src="https://cloud.githubusercontent.com/assets/532272/21507867/3376e9fe-cc4a-11e6-9350-7ec4f680da36.gif">Markdown magic uses comment blocks in markdown files to automatically sync or transform it's contents. | ||
<img align="right" width="200" height="183" src="https://cloud.githubusercontent.com/assets/532272/21507867/3376e9fe-cc4a-11e6-9350-7ec4f680da36.gif">Markdown magic uses comment blocks in markdown files to automatically sync or transform its contents. | ||
@@ -349,2 +349,2 @@ - Automatically keep markdown files up to date from local or remote code sources | ||
[mit]: http://opensource.org/licenses/MIT | ||
[author]: http://github.com/davidwells | ||
[author]: http://github.com/davidwells |
58271
875
349
30