Sfoglia il codice sorgente

Enable frontmatter

Craig Fletcher 1 anno fa
parent
commit
6536ecee1d
1 ha cambiato i file con 10 aggiunte e 6 eliminazioni
  1. 10 6
      .npm-scripts/funcs/markdownToHtml.js

+ 10 - 6
.npm-scripts/funcs/markdownToHtml.js

@@ -2,11 +2,15 @@ const hubdown = require("hubdown");
 
 
 module.exports = function(config, item) {
 module.exports = function(config, item) {
   return new Promise(function(resolve) {
   return new Promise(function(resolve) {
-    hubdown(item.content).then(doc => {
-      resolve({
-        ...item,
-        content: doc.content
-      });
-    });
+    console.log("item content:", item.content);
+    hubdown(item.content || "", { frontmatter: true })
+      .then(doc => {
+        console.log("Doc:", doc);
+        resolve({
+          ...item,
+          ...doc
+        });
+      })
+      .catch(e => console.log);
   });
   });
 };
 };