2020-07-31 14:26:39 +03:00
|
|
|
import React, { Fragment, useState, useEffect, useRef } from 'react'
|
💫 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 PropTypes from 'prop-types'
|
|
|
|
import classNames from 'classnames'
|
2020-08-06 01:51:55 +03:00
|
|
|
import { window, document } from 'browser-monads'
|
💫 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 Section from './section'
|
|
|
|
import Icon from './icon'
|
|
|
|
import { H2 } from './typography'
|
2020-07-31 14:26:39 +03:00
|
|
|
import { copyToClipboard } from './copy'
|
💫 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 classes from '../styles/quickstart.module.sass'
|
|
|
|
|
2019-03-12 17:21:58 +03:00
|
|
|
function getNewChecked(optionId, checkedForId, multiple) {
|
|
|
|
if (!multiple) return [optionId]
|
|
|
|
if (checkedForId.includes(optionId)) return checkedForId.filter(opt => opt !== optionId)
|
|
|
|
return [...checkedForId, optionId]
|
|
|
|
}
|
|
|
|
|
2020-07-31 14:26:39 +03:00
|
|
|
const Quickstart = ({
|
2020-08-06 02:22:49 +03:00
|
|
|
data = [],
|
2020-07-31 14:26:39 +03:00
|
|
|
title,
|
|
|
|
description,
|
2020-08-06 02:22:49 +03:00
|
|
|
copy = true,
|
2020-07-31 14:26:39 +03:00
|
|
|
download,
|
2020-08-13 02:17:40 +03:00
|
|
|
rawContent = null,
|
2020-08-06 02:22:49 +03:00
|
|
|
id = 'quickstart',
|
2020-07-31 14:26:39 +03:00
|
|
|
setters = {},
|
|
|
|
hidePrompts,
|
2020-08-13 02:17:40 +03:00
|
|
|
small,
|
|
|
|
codeLang,
|
2020-07-31 14:26:39 +03:00
|
|
|
children,
|
|
|
|
}) => {
|
|
|
|
const contentRef = useRef()
|
|
|
|
const copyAreaRef = useRef()
|
|
|
|
const isClient = typeof window !== 'undefined'
|
|
|
|
const supportsCopy = isClient && document.queryCommandSupported('copy')
|
|
|
|
const showCopy = supportsCopy && copy
|
💫 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 [styles, setStyles] = useState({})
|
|
|
|
const [checked, setChecked] = useState({})
|
|
|
|
const [initialized, setInitialized] = useState(false)
|
2020-07-31 14:26:39 +03:00
|
|
|
const [copySuccess, setCopySuccess] = useState(false)
|
|
|
|
const [otherState, setOtherState] = useState({})
|
|
|
|
const setOther = (id, value) => setOtherState({ ...otherState, [id]: value })
|
2020-08-13 02:17:40 +03:00
|
|
|
const getRawContent = ref => {
|
|
|
|
if (rawContent !== null) return rawContent
|
|
|
|
if (ref.current && ref.current.childNodes) {
|
|
|
|
// Select all currently visible nodes (spans and text nodes)
|
|
|
|
const result = [...ref.current.childNodes].filter(el => el.offsetParent !== null)
|
|
|
|
return result.map(el => el.textContent).join('\n')
|
|
|
|
}
|
|
|
|
return ''
|
|
|
|
}
|
|
|
|
|
2020-07-31 14:26:39 +03:00
|
|
|
const onClickCopy = () => {
|
|
|
|
copyAreaRef.current.value = getRawContent(contentRef)
|
|
|
|
copyToClipboard(copyAreaRef, setCopySuccess)
|
|
|
|
}
|
💫 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 getCss = (id, checkedOptions) => {
|
|
|
|
const checkedForId = checkedOptions[id] || []
|
|
|
|
const exclude = checkedForId
|
|
|
|
.map(value => `:not([data-quickstart-${id}="${value}"])`)
|
|
|
|
.join('')
|
|
|
|
return `[data-quickstart-results]>[data-quickstart-${id}]${exclude} {display: none}`
|
|
|
|
}
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
window.dispatchEvent(new Event('resize')) // scroll position for progress
|
|
|
|
if (!initialized) {
|
|
|
|
const initialChecked = Object.assign(
|
|
|
|
{},
|
2020-07-31 14:26:39 +03:00
|
|
|
...data.map(({ id, options = [] }) => ({
|
💫 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
|
|
|
[id]: options.filter(option => option.checked).map(({ id }) => id),
|
|
|
|
}))
|
|
|
|
)
|
|
|
|
const initialStyles = Object.assign(
|
|
|
|
{},
|
|
|
|
...data.map(({ id }) => ({ [id]: getCss(id, initialChecked) }))
|
|
|
|
)
|
|
|
|
setChecked(initialChecked)
|
|
|
|
setStyles(initialStyles)
|
|
|
|
setInitialized(true)
|
|
|
|
}
|
2019-03-12 17:21:58 +03:00
|
|
|
}, [data, initialized])
|
💫 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
|
|
|
|
|
|
|
return !data.length ? null : (
|
|
|
|
<Section id={id}>
|
2020-07-31 14:26:39 +03:00
|
|
|
<div className={classNames(classes.root, { [classes.hidePrompts]: !!hidePrompts })}>
|
💫 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
|
|
|
{title && (
|
2019-03-14 19:56:53 +03:00
|
|
|
<H2 className={classes.title} name={id}>
|
💫 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
|
|
|
<a href={`#${id}`}>{title}</a>
|
|
|
|
</H2>
|
|
|
|
)}
|
|
|
|
|
|
|
|
{description && <p className={classes.description}>{description}</p>}
|
|
|
|
|
2020-07-31 14:26:39 +03:00
|
|
|
{data.map(
|
|
|
|
({
|
|
|
|
id,
|
|
|
|
title,
|
|
|
|
options = [],
|
|
|
|
dropdown = [],
|
|
|
|
defaultValue,
|
|
|
|
multiple,
|
|
|
|
other,
|
|
|
|
help,
|
|
|
|
}) => {
|
|
|
|
// Optional function that's called with the value
|
|
|
|
const setterFunc = setters[id] || (() => {})
|
|
|
|
return (
|
|
|
|
<div key={id} data-quickstart-group={id} className={classes.group}>
|
|
|
|
<style data-quickstart-style={id} scoped>
|
|
|
|
{styles[id] ||
|
|
|
|
`[data-quickstart-results]>[data-quickstart-${id}] { display: none }`}
|
|
|
|
</style>
|
|
|
|
<div className={classes.legend}>
|
|
|
|
{title}
|
|
|
|
{help && (
|
|
|
|
<span data-tooltip={help} className={classes.help}>
|
|
|
|
{' '}
|
|
|
|
<Icon name="help" width={16} spaced />
|
|
|
|
</span>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
<div className={classes.fields}>
|
|
|
|
{!!dropdown.length && (
|
|
|
|
<select
|
|
|
|
defaultValue={defaultValue}
|
|
|
|
className={classes.select}
|
|
|
|
onChange={({ target }) => {
|
|
|
|
const value = target.value
|
|
|
|
if (value != other) {
|
|
|
|
setterFunc(value)
|
|
|
|
setOther(id, false)
|
|
|
|
} else {
|
|
|
|
setterFunc('')
|
|
|
|
setOther(id, true)
|
💫 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
|
|
|
}
|
|
|
|
}}
|
|
|
|
>
|
2020-07-31 14:26:39 +03:00
|
|
|
{dropdown.map(({ id, title }) => (
|
|
|
|
<option key={id} value={id}>
|
|
|
|
{title}
|
|
|
|
</option>
|
|
|
|
))}
|
|
|
|
{other && <option value={other}>{other}</option>}
|
|
|
|
</select>
|
|
|
|
)}
|
|
|
|
{other && otherState[id] && (
|
|
|
|
<input
|
|
|
|
type="text"
|
|
|
|
className={classes.textInput}
|
|
|
|
placeholder="Type here..."
|
|
|
|
onChange={({ target }) => setterFunc(target.value)}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
{options.map(option => {
|
|
|
|
const optionType = multiple ? 'checkbox' : 'radio'
|
|
|
|
const checkedForId = checked[id] || []
|
|
|
|
return (
|
|
|
|
<Fragment key={option.id}>
|
|
|
|
<input
|
|
|
|
onChange={() => {
|
|
|
|
const newChecked = {
|
|
|
|
...checked,
|
|
|
|
[id]: getNewChecked(
|
|
|
|
option.id,
|
|
|
|
checkedForId,
|
|
|
|
multiple
|
|
|
|
),
|
|
|
|
}
|
|
|
|
setChecked(newChecked)
|
|
|
|
setStyles({
|
|
|
|
...styles,
|
|
|
|
[id]: getCss(id, newChecked),
|
|
|
|
})
|
|
|
|
setterFunc(newChecked[id])
|
|
|
|
}}
|
|
|
|
type={optionType}
|
|
|
|
className={classNames(
|
|
|
|
classes.input,
|
|
|
|
classes[optionType]
|
|
|
|
)}
|
|
|
|
name={id}
|
|
|
|
id={`quickstart-${option.id}`}
|
|
|
|
value={option.id}
|
|
|
|
checked={checkedForId.includes(option.id)}
|
|
|
|
/>
|
|
|
|
<label
|
|
|
|
className={classes.label}
|
|
|
|
htmlFor={`quickstart-${option.id}`}
|
💫 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
|
|
|
>
|
2020-07-31 14:26:39 +03:00
|
|
|
{option.title}
|
|
|
|
{option.meta && (
|
|
|
|
<span className={classes.meta}>
|
|
|
|
{option.meta}
|
|
|
|
</span>
|
|
|
|
)}
|
|
|
|
{option.help && (
|
|
|
|
<span
|
|
|
|
data-tooltip={option.help}
|
|
|
|
className={classes.help}
|
|
|
|
>
|
|
|
|
{' '}
|
|
|
|
<Icon name="help" width={16} spaced />
|
|
|
|
</span>
|
|
|
|
)}
|
|
|
|
</label>
|
|
|
|
</Fragment>
|
|
|
|
)
|
|
|
|
})}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
)}
|
💫 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
|
|
|
<pre className={classes.code}>
|
2020-08-13 02:17:40 +03:00
|
|
|
<code
|
|
|
|
className={classNames(classes.results, {
|
|
|
|
[classes.small]: !!small,
|
|
|
|
[`language-${codeLang}`]: !!codeLang,
|
|
|
|
})}
|
|
|
|
data-quickstart-results=""
|
|
|
|
ref={contentRef}
|
|
|
|
>
|
💫 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
|
|
|
{children}
|
|
|
|
</code>
|
2020-07-31 14:26:39 +03:00
|
|
|
|
|
|
|
<menu className={classes.menu}>
|
|
|
|
{showCopy && (
|
|
|
|
<button
|
|
|
|
title="Copy to clipboard"
|
|
|
|
onClick={onClickCopy}
|
|
|
|
className={classes.iconButton}
|
|
|
|
>
|
|
|
|
<Icon width={18} name={copySuccess ? 'accept' : 'clipboard'} />
|
|
|
|
</button>
|
|
|
|
)}
|
|
|
|
{download && (
|
|
|
|
<a
|
|
|
|
href={`data:application/octet-stream,${getRawContent(contentRef)}`}
|
|
|
|
title="Download file"
|
|
|
|
download={download}
|
|
|
|
className={classes.iconButton}
|
|
|
|
>
|
|
|
|
<Icon width={18} name="download" />
|
|
|
|
</a>
|
|
|
|
)}
|
|
|
|
</menu>
|
💫 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
|
|
|
</pre>
|
2020-07-31 14:26:39 +03:00
|
|
|
{showCopy && <textarea ref={copyAreaRef} className={classes.copyArea} rows={1} />}
|
💫 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>
|
|
|
|
</Section>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
Quickstart.propTypes = {
|
|
|
|
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
|
|
description: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
|
|
data: PropTypes.arrayOf(
|
|
|
|
PropTypes.shape({
|
|
|
|
id: PropTypes.string.isRequired,
|
|
|
|
title: PropTypes.string.isRequired,
|
|
|
|
multiple: PropTypes.bool,
|
|
|
|
options: PropTypes.arrayOf(
|
|
|
|
PropTypes.shape({
|
|
|
|
id: PropTypes.string.isRequired,
|
|
|
|
title: PropTypes.string.isRequired,
|
|
|
|
checked: PropTypes.bool,
|
|
|
|
help: PropTypes.string,
|
|
|
|
})
|
|
|
|
),
|
|
|
|
help: PropTypes.string,
|
|
|
|
})
|
|
|
|
),
|
|
|
|
}
|
|
|
|
|
2020-07-31 14:26:39 +03:00
|
|
|
const QS = ({ children, prompt = 'bash', divider = false, comment = false, ...props }) => {
|
💫 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 qsClassNames = classNames({
|
|
|
|
[classes.prompt]: !!prompt && !divider,
|
|
|
|
[classes.bash]: prompt === 'bash' && !divider,
|
|
|
|
[classes.python]: prompt === 'python' && !divider,
|
|
|
|
[classes.divider]: !!divider,
|
2020-07-31 14:26:39 +03:00
|
|
|
[classes.comment]: !!comment,
|
💫 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 attrs = Object.assign(
|
|
|
|
{},
|
|
|
|
...Object.keys(props).map(key => ({
|
|
|
|
[`data-quickstart-${key}`]: props[key],
|
|
|
|
}))
|
|
|
|
)
|
|
|
|
return (
|
|
|
|
<span className={qsClassNames} {...attrs}>
|
|
|
|
{children}
|
|
|
|
</span>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export { Quickstart, QS }
|