1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00

fixed text blocks

This commit is contained in:
Fedor Katurov 2019-11-27 10:01:10 +07:00
parent 1169a90553
commit e3bfacddcb
2 changed files with 8 additions and 3 deletions

View file

@ -94,9 +94,14 @@ export const formatText = (text: string): string =>
.replace(/:\|--\|/gim, '://')
.split('\n')
.filter(el => el.trim().length)
// .map(el => `<p>${el}</p>`)
.join('\n');
export const formatTextParagraphs = (text: string): string =>
text
.split('\n')
.map(str => `<p>${str}</p>`)
.join('\n');
export const findBlockType = (line: string): ValueOf<typeof COMMENT_BLOCK_TYPES> => {
const match = Object.values(COMMENT_BLOCK_DETECTORS).find(detector => line.match(detector.test));
return (match && match.type) || COMMENT_BLOCK_TYPES.TEXT;