The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
-## v1.0.0 - 2017-07-03
+## [1.0.1] - 2017-07-03
+### Added
+- Add styling for code
+
+### Changed
+- Swap markdown engine for showdown
+- Remove `v` from CHANGELOG
+- Fix crash when generator attempted to run without 3 posts
+
+
+## 1.0.0 - 2017-07-03
### Added
- JSDoc config
- Eslint config
- A Readme
[Unreleased]: https://github.com/rbdr/blog/compare/master...develop
+[1.0.1]: https://github.com/rbdr/blog/compare/1.0.0...1.0.1
'use strict';
const Fs = require('fs');
-const Markdown = require('markdown');
const Mustache = require('mustache');
const Ncp = require('ncp');
const Path = require('path');
const Rimraf = require('rimraf');
+const Showdown = require('showdown');
const Util = require('util');
const internals = {
for (let i = 0; i < this.maxPosts; ++i) {
const sourcePath = Path.join(this.postsDirectory, `${i}`);
- const assetsSource = Path.join(sourcePath, internals.kAssetsDirectoryName);
- const postContentPath = await this._findBlogContent(sourcePath);
- internals.debuglog(`Copying ${assetsSource} to ${assetsTarget}`);
- await internals.ncp(assetsSource, assetsTarget);
+ try {
+ await internals.fs.access(this.postsDirectory);
+
+ const assetsSource = Path.join(sourcePath, internals.kAssetsDirectoryName);
+ const postContentPath = await this._findBlogContent(sourcePath);
+
+ internals.debuglog(`Copying ${assetsSource} to ${assetsTarget}`);
+ await internals.ncp(assetsSource, assetsTarget);
- internals.debuglog(`Reading ${postContentPath}`);
- const postContent = await internals.fs.readFile(postContentPath, { encoding: 'utf8' });
+ internals.debuglog(`Reading ${postContentPath}`);
+ const postContent = await internals.fs.readFile(postContentPath, { encoding: 'utf8' });
- internals.debuglog('Parsing markdown');
- posts.push({
- html: Markdown.markdown.toHTML(postContent),
- id: i + 1
- });
+ internals.debuglog('Parsing markdown');
+ const parser = new Showdown.Converter();
+ posts.push({
+ html: parser.makeHtml(postContent),
+ id: i + 1
+ });
+ }
+ catch (error) {
+ if (error.code === internals.kFileNotFoundError) {
+ internals.debuglog(`Skipping ${i}`);
+ continue;
+ }
+
+ throw error;
+ }
}
internals.debuglog(`Reading ${indexLocation}`);