Sha256: b6e5c03b070db320c56dfe9ac11041812e1ba063405198536b60e35c8c954565

Contents?: true

Size: 523 Bytes

Versions: 4

Compression:

Stored size: 523 Bytes

Contents

(function() {

if (typeof self === 'undefined' || !self.Prism || !self.document) {
	return;
}

Prism.hooks.add('before-sanity-check', function (env) {
	if (env.code) {
		var pre = env.element.parentNode;
		var clsReg = /\s*\bkeep-initial-line-feed\b\s*/;
		if (
			pre && pre.nodeName.toLowerCase() === 'pre' &&
			// Apply only if nor the <pre> or the <code> have the class
			(!clsReg.test(pre.className) && !clsReg.test(env.element.className))
		) {
			env.code = env.code.replace(/^(?:\r?\n|\r)/, '');
		}
	}
});

}());

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
prism-rails-1.6.0.3 vendor/assets/javascripts/prism-plugin/prism-remove-initial-line-feed.js
prism-rails-1.6.0.2 vendor/assets/javascripts/prism-plugin/prism-remove-initial-line-feed.js
prism-rails-1.6.0.1 vendor/assets/javascripts/prism-plugin/prism-remove-initial-line-feed.js
prism-rails-1.5.1.2 vendor/assets/javascripts/prism-remove-initial-line-feed.js