From 5cd9007edfc95345b4e32466057b81eae9faae1c Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Tue, 21 Jun 2016 13:21:25 +0300 Subject: [PATCH] Render `code_inline` & `code_block` attributes if exist, #261 --- CHANGELOG.md | 6 ++++++ lib/renderer.js | 18 ++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a4f1c5..f1608e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +6.1.1 / WIP +------------------ + +- Render `code_inline` & `code_block` attributes if exist. + + 6.1.0 / 2016-06-19 ------------------ diff --git a/lib/renderer.js b/lib/renderer.js index 34628ed..c9077b1 100644 --- a/lib/renderer.js +++ b/lib/renderer.js @@ -18,13 +18,23 @@ var escapeHtml = require('./common/utils').escapeHtml; var default_rules = {}; -default_rules.code_inline = function (tokens, idx /*, options, env */) { - return '' + escapeHtml(tokens[idx].content) + ''; +default_rules.code_inline = function (tokens, idx, options, env, slf) { + var token = tokens[idx], + attrs = slf.renderAttrs(token); + + return '' + + escapeHtml(tokens[idx].content) + + ''; }; -default_rules.code_block = function (tokens, idx /*, options, env */) { - return '
' + escapeHtml(tokens[idx].content) + '
\n'; +default_rules.code_block = function (tokens, idx, options, env, slf) { + var token = tokens[idx], + attrs = slf.renderAttrs(token); + + return '' + + escapeHtml(tokens[idx].content) + + '\n'; };