<commit_before>'use strict';

var makeElement = require('dom-ext/document/#/make-element')
  , getId       = require('dom-ext/html-element/#/get-id');

module.exports = function (containerName) {
	return function (input, options) {
		var el = makeElement.bind(input.document);
		return el(containerName,
			(options.label && [el('label',
				(input.control ? { for: getId.call(input.control) } : null),
				options.label, ':', ' ')]) || null,
			el('div', { class: 'input' }, input,
				options.disabled ? null : el('span', { class: 'statuses' },
					// missing (required field) mark
					el('span', { class: 'status-missing' }, '★'),
					// validation status mark
					el('span', { class: 'status-ok' }, '✓'),
					// validation status mark
					el('span', { class: 'status-error' }, '✕')),
				// error message
				el('span', { class: 'error-message error-message-' +
					input._name.replace(/[:#\/]/g, '-') }),
				// hint
				options.hint && el('span', { class: 'hint' }, options.hint)));
	};
};<commit_msg>Support markdown for hints<commit_after>'use strict';

var makeElement = require('dom-ext/document/#/make-element')
  , getId       = require('dom-ext/html-element/#/get-id')
  , i18nToDom   = require('i18n2-md-to-dom')
  , memoize     = require('memoizee/weak-plain')

  , mdiOptions = { inline: true };

var getMdi = memoize(function (document) {
	var mdi = i18nToDom(document);
	return function (message) { return mdi(message, mdiOptions); };
});

module.exports = function (containerName) {
	return function (input, options) {
		var el = makeElement.bind(input.document), mdi = getMdi(input.document);
		return el(containerName,
			(options.label && [el('label',
				(input.control ? { for: getId.call(input.control) } : null),
				options.label, ':', ' ')]) || null,
			el('div', { class: 'input' }, input,
				options.disabled ? null : el('span', { class: 'statuses' },
					// missing (required field) mark
					el('span', { class: 'status-missing' }, '★'),
					// validation status mark
					el('span', { class: 'status-ok' }, '✓'),
					// validation status mark
					el('span', { class: 'status-error' }, '✕')),
				// error message
				el('span', { class: 'error-message error-message-' +
					input._name.replace(/[:#\/]/g, '-') }),
				// hint
				options.hint && el('span', { class: 'hint' },
					typeof options.hint === 'string' ? mdi(options.hint) : options.hint)));
	};
};
{'fraction_non_alphanumeric': 0.20914760914760916, 'fraction_numerical': 0.0029106029106029108, 'mean_word_length': 3.2887700534759357, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '2252509', 'n_tokens_mistral': 917, 'n_tokens_neox': 797, 'n_words': 171}