Sha256: 80072d3081757053eafeb509761fbfc23e9d2ae0f9ae927636231cc713b5dee5
Contents?: true
Size: 590 Bytes
Versions: 58
Compression:
Stored size: 590 Bytes
Contents
var beautify = require('js-beautify').html; var entityMap = { "&": "&", "<": "<", ">": ">", '"': '"', "'": ''', "/": '/' }; module.exports.register = function (Handlebars, options) { Handlebars.registerHelper('code', function (hboptions) { var codeStr = beautify(String(hboptions.fn(this)).trim(), { "wrap_line_length": 80, "wrap_attributes": "auto", "indent_scripts": "normal" }).replace(/[&<>"'\/]/g, function (s) { return entityMap[s]; }); return '<div class="example-code">' + codeStr + '</div>'; }); };
Version data entries
58 entries across 58 versions & 3 rubygems