<commit_before>/*

	jquery-markd
	--------

	@file	   jquery-markd.js
	@version	
	@date	   18.08.12
	@author	 <NAME> <<EMAIL>>

	Copyright (c) 2012 DB Medialab AS <http://www.dbmedialab.no/>

*/

(function($) {

	$.fn.markd = function(options){
		
		// Extend our default options with those provided.
		var opts = $.extend({}, $.fn.markd.defaults, options);
		
		return this.each(function(){

			$(this).addClass('reword mousetrap');

			var _element  = $(this);
			var _parser = window.marked;
			var _is_fullscreen = false;
			var preview = {};
			var offset = _element.offset();
			
			//Set options for marked
			_parser.setOptions({ 
				pedantic: opts.parser.pedantic, 
				sanitize: opts.parser.sanitize
			});
			
			/**
			 * Get user input
			 * @param	{element}
			 * @return	{string}
			 **/
			function _getContent(el){
				if(el.is('textarea')){
					return el.val();
				} else {
					return document.getElementById(el.attr('id')).innerText;
				};
			};
			
			/**
			 * Update user input-field
			 * @param	{element}
			 * @param	{string}
			 * @return	{void}
			 **/
			function _setContent(el, content){
				if(el.is('textarea')){
					el.val(content);
				} else {
					//content = content.replace(/\u00a0/g, ' ').replace(/&nbsp;/g, ' ');
					content = content.replace(/\n/g, '<br>');
					el.html(content);
				};
			};
			
			/**
			 * Create a new iframe at the top of the document
			 * @param	{none}
			 * @return	{object} reference to the iframe<commit_msg>Fixed 'double space' break to next line issue when using 'contenteditable'.<commit_after>/*

	jquery-markd
	--------

	@file	   jquery-markd.js
	@version	
	@date	   18.08.12
	@author	 <NAME> <<EMAIL>>

	Copyright (c) 2012 DB Medialab AS <http://www.dbmedialab.no/>

*/

(function($) {

	$.fn.markd = function(options){
		
		// Extend our default options with those provided.
		var opts = $.extend({}, $.fn.markd.defaults, options);
		
		return this.each(function(){

			$(this).addClass('reword mousetrap');

			var _element  = $(this);
			var _parser = window.marked;
			var _is_fullscreen = false;
			var preview = {};
			var offset = _element.offset();
			
			//Set options for marked
			_parser.setOptions({ 
				pedantic: opts.parser.pedantic, 
				sanitize: opts.parser.sanitize
			});
			
			/**
			 * Get user input
			 * @param	{element}
			 * @return	{string}
			 **/
			function _getContent(el){
				if(el.is('textarea')){
					return el.val();
				} else {
					var content = document.getElementById(el.attr('id')).innerText;
					//Get this, 2 spaces in a content editable actually converts to:
					//0020 00a0, meaning, "space no-break space". So, manually convert
					//no-break spaces to spaces again before handing to marked.
					//Thanks to O<NAME> for that little tidbit.
					content = content.replace(/\u00a0/g, ' ').replace(/&nbsp;/g, ' ');
					return content;
				};
			};
			
			/**
			 * Update user input-field
			 * @param	{element}
			 * @param	{string}
			 * @return	{void}
			 **/
			function _setContent(el, content){
				if(el.is('textarea')){
					el.val(content);
				} else {
					content = content.replace(/\n/g, '<br>');
					el.html(content);
				};
			};
			
			/**
			 * Create a new iframe at the top of the document
			 * @param	{none}
			 * @return	{object} reference to the iframe
{'fraction_non_alphanumeric': 0.16334541062801933, 'fraction_numerical': 0.010265700483091788, 'mean_word_length': 2.465481171548117, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '886459', 'n_tokens_mistral': 1439, 'n_tokens_neox': 1102, 'n_words': 276}