From 1baf34d7e1d2b2d58013a2ba91fdd69bceb8c32c Mon Sep 17 00:00:00 2001 From: Dave Herman Date: Thu, 23 Aug 2012 11:29:42 -0700 Subject: [PATCH 1/2] fix for issue 21: use 'xml' as language to highlight HTML tokens --- lib/codex/project.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/codex/project.js b/lib/codex/project.js index 7039655..567e7fa 100644 --- a/lib/codex/project.js +++ b/lib/codex/project.js @@ -47,6 +47,7 @@ Project.prototype.parseMarkdown = function (text) { if (token.type == 'code') { var lang = token.lang || 'javascript'; if (lang == 'js') lang = 'javascript'; + if (lang == 'html') lang = 'xml'; token.text = highlight.highlight(lang, token.text).value; token.escaped = true; } From 1f862faf5a6c803d82654919e975a1773219180f Mon Sep 17 00:00:00 2001 From: Dave Herman Date: Thu, 23 Aug 2012 12:06:40 -0700 Subject: [PATCH 2/2] fix for issue #23: don't crash on unrecognized languages --- lib/codex/project.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/codex/project.js b/lib/codex/project.js index 567e7fa..293cd67 100644 --- a/lib/codex/project.js +++ b/lib/codex/project.js @@ -48,8 +48,10 @@ Project.prototype.parseMarkdown = function (text) { var lang = token.lang || 'javascript'; if (lang == 'js') lang = 'javascript'; if (lang == 'html') lang = 'xml'; - token.text = highlight.highlight(lang, token.text).value; - token.escaped = true; + if (highlight.LANGUAGES.hasOwnProperty(lang)) { + token.text = highlight.highlight(lang, token.text).value; + token.escaped = true; + } } } text = marked.parser(tokens);