Markdown component refactoring: move core to lib/text
This commit is contained in:
1 parent
bb393becc4
commit
b78d78710c
2 files changed
+21
-8
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import MarkdownIt from 'markdown-it'
|
||||
import Typograf from 'typograf'
|
||||
|
||||
const tp = new Typograf({ locale: ['ru'] })
|
||||
const md = new MarkdownIt({
|
||||
html: true,
|
||||
})
|
||||
|
||||
export type MarkdownProps = {
|
||||
data: string
|
||||
}
|
||||
|
||||
export function markdownToHtml(data: string): string {
|
||||
return md.render(data)
|
||||
}
|
||||
|
||||
export function typograf(data: string): string {
|
||||
return tp.execute(data)
|
||||
}
|
||||
Reference in new issue
Block a user