UNPKG

@diplodoc/transform

Version:

A simple transformer of text in YFM (Yandex Flavored Markdown) to HTML

24 lines 790 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getPreparedLeftContent = exports.removeIndentBlock = void 0; function removeIndentBlock(str) { let i = str.length - 1; let curChar = str[i]; while (curChar === ' ') { curChar = str[--i]; } if (curChar === '\n') { return str.substring(0, i + 1); } return str; } exports.removeIndentBlock = removeIndentBlock; function getPreparedLeftContent({ content, tagStartPos, tagContent }) { const preparedLeftContent = content.substring(0, tagStartPos); if (tagContent === '') { return removeIndentBlock(preparedLeftContent); } return preparedLeftContent; } exports.getPreparedLeftContent = getPreparedLeftContent; //# sourceMappingURL=utils.js.map