From 36a98d29d1723111385f9f5f4798a67b00440a19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20Schl=C3=B6mer?= Date: Tue, 4 Nov 2014 17:53:01 +0100 Subject: [PATCH] discriminate between en-dash, em-dash Typically, en-dashes are created by double dashes `--`, em-dashes by triple dashes `---` (e.g., [compose key syntax](http://en.wikipedia.org/wiki/Wikipedia:How_to_make_dashes) or [LaTeX](http://tex.stackexchange.com/a/3821/13262)). This pull request implements this behavior. --- lib/kramed.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/kramed.js b/lib/kramed.js index 30b8126..9fe0758 100644 --- a/lib/kramed.js +++ b/lib/kramed.js @@ -772,7 +772,9 @@ InlineLexer.prototype.smartypants = function(text) { if (!this.options.smartypants) return text; return text // em-dashes - .replace(/--/g, '\u2014') + .replace(/---/g, '\u2014') + // en-dashes + .replace(/--/g, '\u2013') // opening singles .replace(/(^|[-\u2014/(\[{"\s])'/g, '$1\u2018') // closing singles & apostrophes