hexo-include-markdown
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -29,6 +29,8 @@ 'use strict'; | ||
for( let p of db.models.Post.entries() ){ | ||
taglist.push({ | ||
source : p[1].source , | ||
markdown : p[1].hexoIncludeMarkdown.markdown | ||
}) | ||
if( p[1].hexoIncludeMarkdown && p[1].hexoIncludeMarkdown.markdown){ | ||
taglist.push({ | ||
source : p[1].source , | ||
markdown : p[1].hexoIncludeMarkdown.markdown | ||
}) | ||
} | ||
} | ||
@@ -109,8 +111,9 @@ resolve({ | ||
let postAndRereshStat = [] | ||
let hexo | ||
let option | ||
let PLUGIN_NM | ||
for( let post of res ){ | ||
let isRefresh = false | ||
let sourcePath = "" | ||
let hexo | ||
let option | ||
let PLUGIN_NM | ||
for( let tagsPost of post ){ | ||
@@ -125,10 +128,11 @@ isRefresh = isRefresh || tagsPost.taglist.refresh | ||
source : sourcePath , | ||
refresh : isRefresh , | ||
hexo : hexo , | ||
option : option , | ||
pluginName : PLUGIN_NM | ||
refresh : isRefresh | ||
}) | ||
} | ||
// console.log(postAndRereshStat) | ||
resolve(postAndRereshStat) | ||
resolve( [ postAndRereshStat , { | ||
hexo : hexo , | ||
option : option , | ||
pluginName : PLUGIN_NM | ||
} ]) | ||
}) | ||
@@ -141,9 +145,10 @@ | ||
new Promise( (resolve , reject) => { | ||
let dbPath = path.join( process.env.PWD || process.cwd() , "db.json" ) | ||
if(res.length > 0){ | ||
let dbPath = path.join( process.env.PWD || process.cwd() , "db.json" ) | ||
let postRS = res[0] | ||
let hexo = res[1].hexo | ||
let option = res[1].option | ||
let PLUGIN_NM = res[1].pluginName | ||
if(postRS.length > 0){ | ||
let hexo = res[0].hexo | ||
let option = res[0].option | ||
let PLUGIN_NM = res[0].pluginName | ||
fs.readFile( dbPath , (err , fileData) => { | ||
@@ -158,3 +163,3 @@ if(err){ | ||
for( let p of db.models.Cache.entries() ){ | ||
for( let r of res ){ | ||
for( let r of postRS ){ | ||
if(r.refresh && p[1]._id == "source/" + r.source ){ | ||
@@ -161,0 +166,0 @@ db.models.Cache[p[0]].hash = "0" |
@@ -11,4 +11,5 @@ 'use strict'; | ||
let tags = data.content.match(/\<\!\-\-\s+?md\s+?.+?\s+?\-\-\>/g) | ||
if(tags){ | ||
return tags.reduce( (promise, value) => | ||
@@ -27,3 +28,3 @@ promise.then( (editedArray) => | ||
data.content = data.content.replace( r[0] , r[1] ) | ||
// save cache data | ||
@@ -30,0 +31,0 @@ if(!data.hexoIncludeMarkdown){ |
{ | ||
"name": "hexo-include-markdown", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"main": "index", | ||
@@ -5,0 +5,0 @@ "dependencies": {}, |
# hexo-include-markdown | ||
This plugin for [Hexo](https://hexo.io/) can easily load markdown files in Markdown . | ||
This plugin for [Hexo](https://hexo.io/) can easily load another markdown files in markdown file . | ||
## Requirements | ||
This plugin supported Hexo 3.2 or later and node.js v4.3 or later. | ||
This plugin supports node.js v4.3 or later. Also , I recommend Hexo v3.2 or later. | ||
@@ -29,3 +29,3 @@ ## Installation | ||
Load markdown with the following code. | ||
Please load another markdown file with the following code. | ||
@@ -36,3 +36,3 @@ <!-- md template.md --> | ||
Next prepare the markdown for the template. For example, create a `source/_template/template.md`. | ||
Next, please create a new markdown for the template. For example, create `source/_ template/template.md` as follows. | ||
@@ -42,3 +42,3 @@ ``` | ||
This content is read from an external markdown file. | ||
Here is the `template.md`'s content . This content is read from an external markdown file. | ||
@@ -45,0 +45,0 @@ ``` |
12597
256