💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 21:31:19 +03:00
|
|
|
import React from 'react'
|
|
|
|
import PropTypes from 'prop-types'
|
|
|
|
import classNames from 'classnames'
|
|
|
|
|
|
|
|
import Tag from './tag'
|
|
|
|
import Button from './button'
|
|
|
|
import Icon from './icon'
|
|
|
|
import { isString, github, headingTextClassName } from './util'
|
|
|
|
import classes from '../styles/typography.module.sass'
|
|
|
|
|
|
|
|
export const H1 = ({ Component = 'h1', className, ...props }) => (
|
|
|
|
<Headline Component={Component} className={classNames(classes.h1, className)} {...props} />
|
|
|
|
)
|
|
|
|
export const H2 = ({ className, ...props }) => (
|
|
|
|
<Headline Component="h2" className={classNames(classes.h2, className)} {...props} />
|
|
|
|
)
|
|
|
|
export const H3 = ({ className, ...props }) => (
|
|
|
|
<Headline Component="h3" className={classNames(classes.h3, className)} {...props} />
|
|
|
|
)
|
|
|
|
export const H4 = ({ className, ...props }) => (
|
|
|
|
<Headline Component="h4" className={classNames(classes.h4, className)} {...props} />
|
|
|
|
)
|
|
|
|
export const H5 = ({ className, ...props }) => (
|
|
|
|
<Headline Component="h5" className={classNames(classes.h5, className)} {...props} />
|
|
|
|
)
|
|
|
|
|
|
|
|
export const P = ({ children, ...props }) => {
|
|
|
|
const dontWrap = ['figure']
|
|
|
|
if (
|
|
|
|
!Array.isArray(children) &&
|
|
|
|
!isString(children) &&
|
|
|
|
children.hasOwnProperty('type') &&
|
|
|
|
dontWrap.includes(children.type)
|
|
|
|
) {
|
|
|
|
return children
|
|
|
|
}
|
|
|
|
return <p {...props}>{children}</p>
|
|
|
|
}
|
|
|
|
|
|
|
|
export const Abbr = ({ title, children }) => (
|
|
|
|
<abbr
|
|
|
|
className={classes.abbr}
|
|
|
|
data-tooltip={title}
|
|
|
|
data-tooltip-style="code"
|
|
|
|
aria-label={title}
|
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</abbr>
|
|
|
|
)
|
|
|
|
|
|
|
|
export const Label = ({ className, ...props }) => (
|
|
|
|
<span className={classNames(classes.label, className)} {...props} />
|
|
|
|
)
|
|
|
|
|
|
|
|
export const InlineList = ({ Component = 'p', gutterBottom = true, className, children }) => {
|
|
|
|
const listClassNames = classNames(classes.inlineList, className, {
|
|
|
|
[classes.noGutter]: !gutterBottom,
|
|
|
|
})
|
|
|
|
return <Component className={listClassNames}>{children}</Component>
|
|
|
|
}
|
|
|
|
|
2020-07-27 19:11:45 +03:00
|
|
|
export const Help = ({ children, size = 16 }) => (
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 21:31:19 +03:00
|
|
|
<span className={classes.help} data-tooltip={children}>
|
2020-07-27 19:11:45 +03:00
|
|
|
<Icon name="help2" width={size} />
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 21:31:19 +03:00
|
|
|
</span>
|
|
|
|
)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allows inserting comments that will appear in .md preview on GitHub, but
|
|
|
|
* won't be included in the final build of the site.
|
|
|
|
*/
|
|
|
|
export const Comment = () => null
|
|
|
|
|
|
|
|
const Permalink = ({ id, children }) =>
|
|
|
|
!id ? (
|
|
|
|
<span className={headingTextClassName}>{children}</span>
|
|
|
|
) : (
|
|
|
|
<a href={`#${id}`} className={classNames(headingTextClassName, classes.permalink)}>
|
|
|
|
{children}
|
|
|
|
</a>
|
|
|
|
)
|
|
|
|
|
|
|
|
const Headline = ({
|
|
|
|
Component,
|
|
|
|
id,
|
2019-03-14 19:56:53 +03:00
|
|
|
name,
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 21:31:19 +03:00
|
|
|
new: version,
|
|
|
|
model,
|
|
|
|
tag,
|
|
|
|
source,
|
|
|
|
hidden,
|
|
|
|
action,
|
|
|
|
className,
|
|
|
|
children,
|
|
|
|
}) => {
|
|
|
|
// This can be set via hidden="true" and as a prop, so we need to accept both
|
|
|
|
if (hidden === true || hidden === 'true') return null
|
2019-02-27 02:16:03 +03:00
|
|
|
const hasAction = !!source || !!action
|
|
|
|
const headingClassNames = classNames(classes.heading, className, {
|
|
|
|
[classes.clear]: hasAction,
|
|
|
|
})
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 21:31:19 +03:00
|
|
|
const tags = tag ? tag.split(',').map(t => t.trim()) : []
|
|
|
|
return (
|
2019-03-14 19:56:53 +03:00
|
|
|
<Component id={id} name={name} className={headingClassNames}>
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 21:31:19 +03:00
|
|
|
<Permalink id={id}>{children} </Permalink>
|
|
|
|
{tags.map((tag, i) => (
|
|
|
|
<Tag spaced key={i}>
|
|
|
|
{tag}
|
|
|
|
</Tag>
|
|
|
|
))}
|
|
|
|
{version && (
|
|
|
|
<Tag spaced variant="new">
|
|
|
|
{version}
|
|
|
|
</Tag>
|
|
|
|
)}
|
|
|
|
{model && (
|
|
|
|
<Tag spaced variant="model">
|
|
|
|
{model}
|
|
|
|
</Tag>
|
|
|
|
)}
|
|
|
|
|
2019-02-27 02:16:03 +03:00
|
|
|
{hasAction && (
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 21:31:19 +03:00
|
|
|
<div className={classes.action}>
|
|
|
|
{source && (
|
|
|
|
<Button icon="code" to={github(source)}>
|
|
|
|
Source
|
|
|
|
</Button>
|
|
|
|
)}
|
|
|
|
{action}
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</Component>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
Headline.propTypes = {
|
|
|
|
Component: PropTypes.oneOfType([PropTypes.element, PropTypes.string]).isRequired,
|
|
|
|
id: PropTypes.oneOfType([PropTypes.string, PropTypes.oneOf([false])]),
|
|
|
|
new: PropTypes.string,
|
|
|
|
model: PropTypes.string,
|
|
|
|
source: PropTypes.string,
|
|
|
|
tag: PropTypes.string,
|
|
|
|
hidden: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['true', 'false'])]),
|
|
|
|
action: PropTypes.node,
|
|
|
|
className: PropTypes.string,
|
|
|
|
}
|