r, parent = element;

					while (parent && !lang.test(parent.className)) {
						parent = parent.parentNode;
					}

					if (parent) {
						language = (parent.className.match(lang) || [,''])[1].toLowerCase();
						grammar = _.languages[language];
					}

					// Set language on the element, if not present
					element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;

					// Set language on the parent, for styling
					parent = element.parentNode;

					if 