showdown/src/subParsers/italicsAndBold.js

10 lines
273 B
JavaScript
Raw Normal View History

2015-01-16 05:21:33 +08:00
showdown.subParser('italicsAndBold', function (text) {
2015-01-19 19:37:21 +08:00
'use strict';
// <strong> must go first:
text = text.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g, '<strong>$2</strong>');
2015-01-16 05:21:33 +08:00
2015-01-19 19:37:21 +08:00
text = text.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g, '<em>$2</em>');
2015-01-16 05:21:33 +08:00
2015-01-19 19:37:21 +08:00
return text;
2015-01-16 05:21:33 +08:00
});