/** * Created by Estevao on 12-01-2015. */ showdown.subParser('italicsAndBold', function (text) { 'use strict'; // must go first: text = text.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g, '$2'); text = text.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g, '$2'); return text; });