render page content based on tokens; ignore rendered content field
This commit is contained in:
1 parent
32d304b26f
commit
bb393becc4
8 files changed
+188
-15
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import { Html } from 'src/components/Html'
|
||||
import MarkdownIt from 'markdown-it'
|
||||
import Typograf from 'typograf'
|
||||
import { memo } from 'react'
|
||||
|
||||
const tp = new Typograf({ locale: ['ru'] })
|
||||
const md = new MarkdownIt({
|
||||
html: true,
|
||||
})
|
||||
|
||||
export type MarkdownProps = {
|
||||
data: string
|
||||
}
|
||||
|
||||
export const Markdown: React.SFC<MarkdownProps> = memo(props => (
|
||||
<Html
|
||||
html={tp.execute(md.render(props.data))}
|
||||
/>
|
||||
))
|
||||
@@ -7,19 +7,13 @@ import { ITag } from 'src/types'
|
||||
|
||||
export type PageProps = {
|
||||
style?: React.CSSProperties
|
||||
children: string
|
||||
date: Date
|
||||
tags: ITag[]
|
||||
}
|
||||
|
||||
export const Page: React.FC<PageProps> = props => (
|
||||
<div className={'page'} style={props.style}>
|
||||
<Html
|
||||
as={'article'}
|
||||
className={'article'}
|
||||
html={props.children}
|
||||
/>
|
||||
|
||||
{props.children}
|
||||
<hr />
|
||||
<Share />
|
||||
|
||||
|
||||
Reference in new issue
Block a user