mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
process markdown in doc description
This commit is contained in:
parent
6eab893dd4
commit
26415c2b1e
@ -1,13 +1,23 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
import remark from 'remark'
|
||||||
|
import remarkReact from 'remark-react'
|
||||||
import styles from './DocHeader.module.scss'
|
import styles from './DocHeader.module.scss'
|
||||||
|
|
||||||
const DocHeader = ({ title, description }) => (
|
const DocHeader = ({ title, description }) => {
|
||||||
|
const descriptionHtml =
|
||||||
|
description &&
|
||||||
|
remark()
|
||||||
|
.use(remarkReact)
|
||||||
|
.processSync(description).contents
|
||||||
|
|
||||||
|
return (
|
||||||
<header className={styles.header}>
|
<header className={styles.header}>
|
||||||
<h1 className={styles.title}>{title}</h1>
|
<h1 className={styles.title}>{title}</h1>
|
||||||
{description && <p className={styles.lead}>{description}</p>}
|
{description && <p className={styles.lead}>{descriptionHtml}</p>}
|
||||||
</header>
|
</header>
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
DocHeader.propTypes = {
|
DocHeader.propTypes = {
|
||||||
title: PropTypes.string.isRequired,
|
title: PropTypes.string.isRequired,
|
||||||
|
Loading…
Reference in New Issue
Block a user