mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
24 lines
628 B
JavaScript
24 lines
628 B
JavaScript
|
/**
|
||
|
* Created by Estevao on 11-01-2015.
|
||
|
*/
|
||
|
|
||
|
showdown.subParser('hashElement', function (text, options, globals) {
|
||
|
'use strict';
|
||
|
|
||
|
return function (wholeMatch, m1) {
|
||
|
var blockText = m1;
|
||
|
|
||
|
// Undo double lines
|
||
|
blockText = blockText.replace(/\n\n/g, '\n');
|
||
|
blockText = blockText.replace(/^\n/, '');
|
||
|
|
||
|
// strip trailing blank lines
|
||
|
blockText = blockText.replace(/\n+$/g, '');
|
||
|
|
||
|
// Replace the element text with a marker ("~KxK" where x is its key)
|
||
|
blockText = '\n\n~K' + (globals.gHtmlBlocks.push(blockText) - 1) + 'K\n\n';
|
||
|
|
||
|
return blockText;
|
||
|
};
|
||
|
});
|