mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
attach readme contents to all repos
This commit is contained in:
parent
f54f714c49
commit
a53c227acc
@ -11,7 +11,7 @@ Every marketplace must run an instance of Aquarius.
|
|||||||
Aquarius provides an API to an off-chain database ("OceanDB") to store and manage metadata about data assets: the assets listed in that marketplace.
|
Aquarius provides an API to an off-chain database ("OceanDB") to store and manage metadata about data assets: the assets listed in that marketplace.
|
||||||
The off-chain database might be MongoDB, Elasticsearch or BigchainDB.
|
The off-chain database might be MongoDB, Elasticsearch or BigchainDB.
|
||||||
|
|
||||||
<repo name="aquarius"></repo>
|
<repo name="aquarius" readme="true"></repo>
|
||||||
|
|
||||||
## Brizo
|
## Brizo
|
||||||
|
|
||||||
|
@ -359,10 +359,21 @@ Note that the component name in Markdown needs to be always in lowercase, and ha
|
|||||||
|
|
||||||
The `Repository` component fetching and displaying information about a GitHub repo. Component can be used in Markdown as `<repo>`, it requires a `name` to be passed:
|
The `Repository` component fetching and displaying information about a GitHub repo. Component can be used in Markdown as `<repo>`, it requires a `name` to be passed:
|
||||||
|
|
||||||
```HTML
|
```html
|
||||||
<repo name="pleuston"></repo>
|
<repo name="pleuston"></repo>
|
||||||
```
|
```
|
||||||
|
|
||||||
Resulting in:
|
Resulting in:
|
||||||
|
|
||||||
<repo name="pleuston"></repo>
|
<repo name="pleuston"></repo>
|
||||||
|
|
||||||
|
You can also pass `readme="true"` and the readme contents of the repo will be rendered:
|
||||||
|
|
||||||
|
```html
|
||||||
|
<repo name="aquarius" readme="true"></repo>
|
||||||
|
```
|
||||||
|
|
||||||
|
Resulting in:
|
||||||
|
|
||||||
|
<repo name="aquarius" readme="true"></repo>
|
||||||
|
|
||||||
|
@ -54,7 +54,9 @@
|
|||||||
"react": "^16.6.1",
|
"react": "^16.6.1",
|
||||||
"react-dom": "^16.6.1",
|
"react-dom": "^16.6.1",
|
||||||
"react-helmet": "^5.2.0",
|
"react-helmet": "^5.2.0",
|
||||||
"rehype-react": "^3.0.3"
|
"rehype-react": "^3.0.3",
|
||||||
|
"remark": "^10.0.0",
|
||||||
|
"remark-react": "^4.0.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@svgr/webpack": "^4.0.2",
|
"@svgr/webpack": "^4.0.2",
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { StaticQuery, graphql } from 'gatsby'
|
import { StaticQuery, graphql } from 'gatsby'
|
||||||
|
import remark from 'remark'
|
||||||
|
import remarkReact from 'remark-react'
|
||||||
import { ReactComponent as Star } from '../../images/star.svg'
|
import { ReactComponent as Star } from '../../images/star.svg'
|
||||||
import { ReactComponent as Forks } from '../../images/forks.svg'
|
import { ReactComponent as Forks } from '../../images/forks.svg'
|
||||||
import styles from './Repository.module.scss'
|
import styles from './Repository.module.scss'
|
||||||
@ -31,6 +33,12 @@ const queryGithub = graphql`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
object(expression: "develop:README.md") {
|
||||||
|
id
|
||||||
|
... on GitHub_Blob {
|
||||||
|
text
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -98,7 +106,7 @@ Numbers.propTypes = {
|
|||||||
url: PropTypes.string.isRequired
|
url: PropTypes.string.isRequired
|
||||||
}
|
}
|
||||||
|
|
||||||
const Repository = ({ name, links }) => (
|
const Repository = ({ name, links, readme }) => (
|
||||||
<StaticQuery
|
<StaticQuery
|
||||||
query={queryGithub}
|
query={queryGithub}
|
||||||
render={data => {
|
render={data => {
|
||||||
@ -119,7 +127,18 @@ const Repository = ({ name, links }) => (
|
|||||||
// e.g. when private repos are referenced in repositories.yml
|
// e.g. when private repos are referenced in repositories.yml
|
||||||
if (repo === undefined) return null
|
if (repo === undefined) return null
|
||||||
|
|
||||||
const { url, description, forkCount, stargazers, releases } = repo
|
const {
|
||||||
|
url,
|
||||||
|
description,
|
||||||
|
forkCount,
|
||||||
|
stargazers,
|
||||||
|
releases,
|
||||||
|
object
|
||||||
|
} = repo
|
||||||
|
|
||||||
|
const readmeHtml = remark()
|
||||||
|
.use(remarkReact)
|
||||||
|
.processSync(object.text).contents
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<article className={styles.repository}>
|
<article className={styles.repository}>
|
||||||
@ -135,6 +154,15 @@ const Repository = ({ name, links }) => (
|
|||||||
url={url}
|
url={url}
|
||||||
/>
|
/>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
{readme && (
|
||||||
|
<aside className={styles.repositoryReadme}>
|
||||||
|
<h3 className={styles.repositoryReadmeTitle}>
|
||||||
|
README.md
|
||||||
|
</h3>
|
||||||
|
{readmeHtml}
|
||||||
|
</aside>
|
||||||
|
)}
|
||||||
</article>
|
</article>
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
@ -143,7 +171,8 @@ const Repository = ({ name, links }) => (
|
|||||||
|
|
||||||
Repository.propTypes = {
|
Repository.propTypes = {
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
links: PropTypes.array
|
links: PropTypes.array,
|
||||||
|
readme: PropTypes.bool
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Repository
|
export default Repository
|
||||||
|
@ -87,3 +87,26 @@
|
|||||||
margin-bottom: -.1rem;
|
margin-bottom: -.1rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.repositoryReadme {
|
||||||
|
margin-top: $spacer;
|
||||||
|
|
||||||
|
h1,
|
||||||
|
h2 {
|
||||||
|
font-size: $font-size-large;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3,
|
||||||
|
h4 {
|
||||||
|
font-size: $font-size-base;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.repositoryReadmeTitle {
|
||||||
|
font-size: $font-size-small !important; // stylelint-disable-line
|
||||||
|
margin: 0;
|
||||||
|
color: $brand-grey-light;
|
||||||
|
margin-bottom: $spacer / 2;
|
||||||
|
padding-bottom: $spacer / 3;
|
||||||
|
border-bottom: 1px solid $brand-grey-lighter;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user