18 lines
		
	
	
		
			657 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			657 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
define([
 | 
						|
    "classes/Extension",
 | 
						|
], function(Extension) {
 | 
						|
 | 
						|
    var emailConverter = new Extension("emailConverter", "Markdown Email", true);
 | 
						|
    emailConverter.settingsBlock = '<p>Converts email adresses in the form <email@example.com> into clickable links.</p>';
 | 
						|
 | 
						|
    emailConverter.onPagedownConfigure = function(editor) {
 | 
						|
        editor.getConverter().hooks.chain("postConversion", function(text) {
 | 
						|
            return text.replace(/<(mailto\:)?([^\s>]+@[^\s>]+\.\S+?)>/g, function(match, mailto, email) {
 | 
						|
                return '<a href="mailto:' + email + '">' + email + '</a>';
 | 
						|
            });
 | 
						|
        });
 | 
						|
    };
 | 
						|
 | 
						|
    return emailConverter;
 | 
						|
});
 |