From f9c90b0cdb15d6a3ef087b79364b979fb8ef81bb Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Wed, 4 Dec 2013 06:21:50 -0600 Subject: [PATCH] see #302. remove all obsolete features. keep things easy to revert. --- README.md | 52 --------------------------------------------- lib/marked.js | 59 ++++++--------------------------------------------- 2 files changed, 7 insertions(+), 104 deletions(-) diff --git a/README.md b/README.md index cd2b479e5c..052b0a91f1 100644 --- a/README.md +++ b/README.md @@ -23,22 +23,14 @@ console.log(marked('I am using __markdown__.')); Example using all options: ```js -// Set default options except highlight which has no default marked.setOptions({ gfm: true, - highlight: function (code, lang, callback) { - pygmentize({ lang: lang, format: 'html' }, code, function (err, result) { - if (err) return callback(err); - callback(null, result.toString()); - }); - }, tables: true, breaks: false, pedantic: false, sanitize: true, smartLists: true, smartypants: false, - langPrefix: 'lang-' }); // Using async version of marked @@ -80,43 +72,6 @@ Default: `true` Enable [GitHub flavored markdown][gfm]. -### highlight - -Type: `Function` - -A function to highlight code blocks. The function takes three arguments: code, -lang, and callback. The above example uses async highlighting with -[node-pygmentize-bundled][pygmentize], and here is a synchronous example using -[highlight.js][highlight] which doesn't require the callback argument: - -```js -marked.setOptions({ - highlight: function(code, lang) { - return hljs.highlightAuto(lang, code).value; - } -}); -``` - -#### highlight arguments - -`code` - -Type: `String` - -The section of code to pass to the highlighter. - -`lang` - -Type: `String` - -The programming language specified in the code block. - -`callback` - -Type: `Function` - -The callback function to call when using an async highlighter. - ### tables Type: `Boolean` @@ -220,13 +175,6 @@ You can control anything you want. - link(href, title, text) - image(href, title, text) -### headerPrefix - -Type: `String` -Default: `` - -Set the prefix for header IDs. - ## Access to lexer and parser You also have direct access to the lexer and parser if you so desire. diff --git a/lib/marked.js b/lib/marked.js index a6d2471539..e70690b241 100644 --- a/lib/marked.js +++ b/lib/marked.js @@ -739,28 +739,18 @@ InlineLexer.prototype.mangle = function(text) { function Renderer() {} -Renderer.prototype.code = function(code, lang, escaped, options) { - options = options || {}; - - if (options.highlight) { - var out = options.highlight(code, lang); - if (out != null && out !== code) { - escaped = true; - code = out; - } - } - +Renderer.prototype.code = function(code, lang) { if (!lang) { return '
'
-      + (escaped ? code : escape(code, true))
+      + escape(code, true)
       + '\n
'; } return '
'
-    + (escaped ? code : escape(code))
+    + escape(code)
     + '\n
\n'; }; @@ -775,9 +765,6 @@ Renderer.prototype.html = function(html) { Renderer.prototype.heading = function(text, level, raw, options) { return '