about summary refs log tree commit diff stats
path: root/src/domain
diff options
context:
space:
mode:
authorAlan Pearce2017-06-25 14:21:23 +0200
committerAlan Pearce2017-06-25 14:21:23 +0200
commit18eeadd14e4ab99f75167f1c97776b57e05bcb74 (patch)
treeb387c672b2ebf7cff02579f7bad96e0e9ab41b97 /src/domain
parent6f9b41464f25d12a24b2672dbf12b43c7df81dd2 (diff)
downloadhomestead-18eeadd14e4ab99f75167f1c97776b57e05bcb74.tar.lz
homestead-18eeadd14e4ab99f75167f1c97776b57e05bcb74.tar.zst
homestead-18eeadd14e4ab99f75167f1c97776b57e05bcb74.zip
feat: beautify HTML output
Indent child templates according to the their place in the parent
template, and likewise for rendered posts

Needs refactoring
Diffstat (limited to 'src/domain')
-rw-r--r--src/domain/posts.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/domain/posts.js b/src/domain/posts.js
index aedf58e..ea81729 100644
--- a/src/domain/posts.js
+++ b/src/domain/posts.js
@@ -4,6 +4,7 @@ const fs = require('fs')
 const path = require('path')
 const matter = require('gray-matter')
 const markdown = require('../modules/markdown.js')
+const { indentForTemplate, postIndentLevel } = require('../responders.js')
 
 const grayMatterOptions = {
   lang: 'toml',
@@ -33,7 +34,10 @@ function get (filename) {
   const fileMatter = matter.read(filename, grayMatterOptions)
   fileMatter.basename = getTitle(fileMatter)
   delete fileMatter.orig
-  fileMatter.body = markdown(fileMatter.content)
+  fileMatter.body = indentForTemplate(
+    markdown(fileMatter.content),
+    postIndentLevel
+  )
   return canonicaliseMetadata(fileMatter)
 }