mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
#60 added typograf
This commit is contained in:
parent
639b9815a8
commit
1f352d876e
2 changed files with 10 additions and 0 deletions
|
@ -18,6 +18,7 @@ import {
|
||||||
formatTextSanitizeTags,
|
formatTextSanitizeTags,
|
||||||
formatTextSanitizeYoutube,
|
formatTextSanitizeYoutube,
|
||||||
formatTextTodos,
|
formatTextTodos,
|
||||||
|
formatTextTypograf,
|
||||||
} from '~/utils/formatText';
|
} from '~/utils/formatText';
|
||||||
import { splitTextByYoutube, splitTextOmitEmpty } from '~/utils/splitText';
|
import { splitTextByYoutube, splitTextOmitEmpty } from '~/utils/splitText';
|
||||||
|
|
||||||
|
@ -102,6 +103,7 @@ export const formatText = pipe(
|
||||||
formatTextTodos,
|
formatTextTodos,
|
||||||
formatExclamations,
|
formatExclamations,
|
||||||
formatTextDash,
|
formatTextDash,
|
||||||
|
formatTextTypograf,
|
||||||
formatTextMarkdown,
|
formatTextMarkdown,
|
||||||
formatTextSanitizeTags,
|
formatTextSanitizeTags,
|
||||||
formatTextClickableUsernames
|
formatTextClickableUsernames
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
import marked from 'marked';
|
import marked from 'marked';
|
||||||
import { stripHTMLTags } from '~/utils/stripHTMLTags';
|
import { stripHTMLTags } from '~/utils/stripHTMLTags';
|
||||||
|
import Typograf from 'typograf';
|
||||||
|
|
||||||
|
const typograf = new Typograf({ locale: ['ru', 'en-US'] });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cleans youtube urls
|
* Cleans youtube urls
|
||||||
|
@ -69,3 +72,8 @@ export const formatTextDash = (text: string): string => text.replace(' -- ', '
|
||||||
* Formats with markdown
|
* Formats with markdown
|
||||||
*/
|
*/
|
||||||
export const formatTextMarkdown = (text: string): string => marked(text);
|
export const formatTextMarkdown = (text: string): string => marked(text);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses typograf.js to prettify text
|
||||||
|
*/
|
||||||
|
export const formatTextTypograf = (text: string): string => typograf.execute(text);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue