blob: bd7d6a01ca3b35066dd22fd53464c9779fa8f921 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
import React from 'react'
import Layout from 'src/components/Layout'
import {graphql} from 'gatsby'
import styled, { ThemeProvider } from 'styled-components'
import {theme} from 'src/theme'
import FoundTypo from 'src/components/FoundTypo'
import Scripts from 'src/components/Scripts'
const version = require('../../../package.json').version
const Content = styled.div`
max-width: 760px;
margin: auto;
padding: 0 30px 120px;
`
const Page = ({data}) => {
const pageData = data.markdownRemark
const html = pageData.html.replace(/(npm-)+([a-zA-Z\\.-]*)<\/h1>/g, 'npm $2</h1>')
return (
<ThemeProvider theme={theme}>
<Layout showSidebar>
<Content className='documentation'>
<div dangerouslySetInnerHTML={{
__html: html.replace(/@VERSION@/g, version)
}} />
<FoundTypo />
<Scripts />
</Content>
</Layout>
</ThemeProvider>
)
}
export default Page
export const query = graphql`
query($slug: String!) {
markdownRemark(fields: { slug: { eq: $slug } }) {
html
fields {
slug
}
}
}
`
|