outdent.js 381 B

123456789101112131415
  1. /**
  2. * Remove one level of line-leading tabs or spaces
  3. */
  4. showdown.subParser('outdent', function (text) {
  5. 'use strict';
  6. // attacklab: hack around Konqueror 3.5.4 bug:
  7. // "----------bug".replace(/^-/g,"") == "bug"
  8. text = text.replace(/^(\t|[ ]{1,4})/gm, '~0'); // attacklab: g_tab_width
  9. // attacklab: clean up hack
  10. text = text.replace(/~0/g, '');
  11. return text;
  12. });