From d87c502c4acb26d1e500653e89da294f89d53bfd Mon Sep 17 00:00:00 2001 From: Federico Soave Date: Sat, 8 Dec 2018 14:13:37 +0100 Subject: [PATCH] use only the first word of the inforstring as the languauge in code blocks (pass cm example 112) --- lib/marked.js | 3 ++- test/specs/commonmark/commonmark-spec.js | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/marked.js b/lib/marked.js index 9383a0bd84..3efcdb5a7c 100644 --- a/lib/marked.js +++ b/lib/marked.js @@ -920,7 +920,8 @@ function Renderer(options) { this.options = options || marked.defaults; } -Renderer.prototype.code = function(code, lang, escaped) { +Renderer.prototype.code = function(code, infostring, escaped) { + var lang = (infostring || '').match(/\S*/)[0]; if (this.options.highlight) { var out = this.options.highlight(code, lang); if (out != null && out !== code) { diff --git a/test/specs/commonmark/commonmark-spec.js b/test/specs/commonmark/commonmark-spec.js index eccf42e60c..631cb8fa64 100644 --- a/test/specs/commonmark/commonmark-spec.js +++ b/test/specs/commonmark/commonmark-spec.js @@ -159,8 +159,7 @@ describe('CommonMark 0.28 Indented code blocks', function() { describe('CommonMark 0.28 Fenced code blocks', function() { var section = 'Fenced code blocks'; - // var shouldPassButFails = []; - var shouldPassButFails = [112]; + var shouldPassButFails = []; var willNotBeAttemptedByCoreTeam = [];