Commit 5aabf122 authored by Rubén Beltran del Río's avatar Rubén Beltran del Río 🐝

Merge branch 'hotfix/1.0.1'

parents 5e265f9d 8ca5460b
......@@ -4,7 +4,17 @@ All notable changes to this project will be documented in this file.
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
......@@ -16,3 +26,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- 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 = {
......@@ -112,20 +112,34 @@ module.exports = class Blog {
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}`);
......
{
"name": "blog",
"version": "1.0.0",
"version": "1.0.1",
"description": "An ephemeral blog",
"main": "lib/blog.js",
"bin": {
......@@ -23,11 +23,11 @@
"homepage": "https://github.com/rbdr/blog#readme",
"dependencies": {
"getenv": "0.7.x",
"markdown": "0.5.x",
"minimist": "1.2.x",
"mustache": "2.3.x",
"ncp": "2.0.x",
"rimraf": "2.6.x"
"rimraf": "2.6.x",
"showdown": "1.7.x"
},
"devDependencies": {
"docdash": "0.4.x",
......
......@@ -24,7 +24,7 @@ header a {
}
main {
background-color: #fff;
background-color: white;
padding: 1.414em;
}
......@@ -46,6 +46,17 @@ h2 { font-size: 2.827em; }
h3 { font-size: 1.999em; }
h4 { font-size: 1.414em; }
code {
background-color: whitesmoke;
padding: 0.2em 0.5em;
}
pre {
background-color: whitesmoke;
padding: 1em;
max-width: 40em;
}
footer {
background-color: pink;
padding: 1.414em;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment