From 18eeadd14e4ab99f75167f1c97776b57e05bcb74 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 25 Jun 2017 14:21:23 +0200 Subject: feat: beautify HTML output Indent child templates according to the their place in the parent template, and likewise for rendered posts Needs refactoring --- src/domain/posts.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/domain') 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) } -- cgit 1.4.1