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

fixed comment block separation

This commit is contained in:
Fedor Katurov 2021-02-24 15:28:11 +07:00
parent 5dbf4245bf
commit 1fc04e62a6
3 changed files with 16 additions and 8 deletions

View file

@ -10,9 +10,9 @@ import { COMMENT_BLOCK_DETECTORS, COMMENT_BLOCK_TYPES, ICommentBlock } from '~/c
import format from 'date-fns/format';
import { pipe } from 'ramda';
import {
formatDash,
formatTextDash,
formatExclamations,
formatMarkdown,
formatTextMarkdown,
formatTextClickableUsernames,
formatTextComments,
formatTextSanitizeTags,
@ -101,8 +101,8 @@ export const formatText = pipe(
formatTextComments,
formatTextTodos,
formatExclamations,
formatDash,
formatMarkdown
formatTextDash,
formatTextMarkdown
);
export const formatTextParagraphs = (text: string): string => (text && formatText(text)) || null;

View file

@ -49,7 +49,7 @@ export const formatTextTodos = (text: string): string =>
* Formats !!exclamation messages with green color
*/
export const formatExclamations = (text: string): string =>
text.replace(/(\!\![\s\S]*?(\!\!|\n|$))/gim, '<span class="green">$1</span>');
text.replace(/(\!\![\s\S]*?(\!\!|\n|$))/gim, '<span class="green">$1$2</span>');
/**
* Formats links
@ -63,9 +63,9 @@ export const formatLinks = (text: string): string =>
/**
* Replaces -- with dash
*/
export const formatDash = (text: string): string => text.replace(' -- ', ' — ');
export const formatTextDash = (text: string): string => text.replace(' -- ', ' — ');
/**
* Formats with markdown
*/
export const formatMarkdown = (text: string): string => marked(text);
export const formatTextMarkdown = (text: string): string => marked(text);