From 4b0720b6ab724c97a32968bddb33fa1837c476aa Mon Sep 17 00:00:00 2001 From: "Daniel G. Taylor" Date: Tue, 16 Dec 2014 17:11:49 -0800 Subject: [PATCH] Switch to Remarkable --- Changelog.md | 6 ++++++ package.json | 2 +- src/main.coffee | 10 ++++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Changelog.md b/Changelog.md index ad8759eb..b442b067 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,9 @@ +# Unreleased +* Switch to [Remarkable](https://github.com/jonschlinkert/remarkable) + Markdown parser, which is faster and supports the new CommonMark + specification. [GFM](https://help.github.com/articles/github-flavored-markdown/) + is supported. + # 1.17.0 - 2014-12-16 * New logo * Add support for [including files] diff --git a/package.json b/package.json index 87f89dbc..9d455dd8 100644 --- a/package.json +++ b/package.json @@ -40,9 +40,9 @@ "coffee-script": "^1.8.0", "highlight.js": "^8.2.0", "jade": "^1.5.0", - "marked": "~0.3.2", "moment": "^2.8.1", "protagonist": "~0.17.1", + "remarkable": "^1.5.0", "socket.io": "^1.0.6", "stylus": "~0.49.2", "yargs": "^1.3.1" diff --git a/src/main.coffee b/src/main.coffee index 334796a4..165e3af5 100644 --- a/src/main.coffee +++ b/src/main.coffee @@ -2,10 +2,10 @@ crypto = require 'crypto' fs = require 'fs' hljs = require 'highlight.js' jade = require 'jade' -marked = require 'marked' moment = require 'moment' path = require 'path' protagonist = require 'protagonist' +Remarkable = require 'remarkable' INCLUDE = /( *)/gmi ROOT = path.dirname __dirname @@ -44,9 +44,11 @@ includeDirective = (includePath, input) -> input.replace INCLUDE, includeReplace.bind(this, includePath) # Setup marked with code highlighting and smartypants -marked.setOptions +md = new Remarkable 'full', + html: true + linkify: true + typographer: true highlight: highlight - smartypants: true # Get a list of available internal templates exports.getTemplates = (done) -> @@ -106,7 +108,7 @@ exports.render = (input, options, done) -> fullWidth: options.fullWidth date: moment highlight: highlight - markdown: marked + markdown: (content) -> md.render content slug: slug hash: (value) -> crypto.createHash('md5').update(value.toString()).digest('hex')