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 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,
|
||||
|
Loading…
Reference in New Issue
Block a user