1
0
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:
Matthias Kretschmann 2018-11-16 14:31:03 +01:00
parent 6eab893dd4
commit 26415c2b1e
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -1,13 +1,23 @@
import React from 'react'
import PropTypes from 'prop-types'
import remark from 'remark'
import remarkReact from 'remark-react'
import styles from './DocHeader.module.scss'
const DocHeader = ({ title, description }) => (
<header className={styles.header}>
<h1 className={styles.title}>{title}</h1>
{description && <p className={styles.lead}>{description}</p>}
</header>
)
const DocHeader = ({ title, description }) => {
const descriptionHtml =
description &&
remark()
.use(remarkReact)
.processSync(description).contents
return (
<header className={styles.header}>
<h1 className={styles.title}>{title}</h1>
{description && <p className={styles.lead}>{descriptionHtml}</p>}
</header>
)
}
DocHeader.propTypes = {
title: PropTypes.string.isRequired,