/
githubmirror
/
marktext
Обзор
Документация
Войти
/
githubmirror
/
marktext
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v0.17.0
test/specs/help.js
27 строк
856 B
Ran Luo
Update Babel to 7.x.x (#1253)
31 авг 2019, 22:30
Не верифицирован
31 авг 2019, 22:30
46371f8
Код
Авторство
О чём код?
export const removeCustomClass = html => { const customClass = ['indented-code-block', 'fenced-code-block', 'task-list-item'] customClass.forEach(className => { if (html.indexOf(className) > -1) { const REG_EXP = new RegExp(`class="${className}"`, 'g') /* eslint-disable no-useless-escape */ const REG_EXP_SIMPLE = new RegExp(className + ' \*', 'g') /* eslint-enable no-useless-escape */ html = html.replace(REG_EXP, '') .replace(REG_EXP_SIMPLE, '') } }) return html } export const padding = (str, len, marker = ' ') => { const spaceLen = len - str.length let preLen = 0 let postLen = 0 if (spaceLen % 2 === 0) { preLen = postLen = spaceLen / 2 } else { preLen = (spaceLen - 1) / 2 postLen = (spaceLen + 1) / 2 } return marker.repeat(preLen) + str + marker.repeat(postLen) }