diff --git a/website/src/components/code.js b/website/src/components/code.js index 478612483..1baf7d561 100644 --- a/website/src/components/code.js +++ b/website/src/components/code.js @@ -1,9 +1,9 @@ import React, { Fragment } from 'react' import PropTypes from 'prop-types' import classNames from 'classnames' -import highlightCode from 'gatsby-remark-prismjs/highlight-code.js' -import 'prismjs-bibtex' -import rangeParser from 'parse-numeric-range' +// import highlightCode from 'gatsby-remark-prismjs/highlight-code.js' +// import 'prismjs-bibtex' +// import rangeParser from 'parse-numeric-range' import { window } from 'browser-monads' import CUSTOM_TYPES from '../../meta/type-annotations.json' @@ -69,7 +69,11 @@ export const TypeAnnotation = ({ lang = 'python', link = true, children }) => { const code = Array.isArray(children) ? children.join('') : children || '' const [rawText, meta] = code.split(/(?= \(.+\)$)/) const rawStr = rawText.replace(/\./g, TMP_DOT) - const rawHtml = lang === 'none' || !code ? code : highlightCode(lang, rawStr) + const rawHtml = + lang === 'none' || !code + ? code + : // highlightCode(lang, rawStr) + '' const html = rawHtml.replace(new RegExp(TMP_DOT, 'g'), '.').replace(/\n/g, ' ') const result = htmlToReact(html) const elements = Array.isArray(result) ? result : [result] @@ -159,7 +163,8 @@ function convertLine(line, i) { ) } - const htmlLine = replacePrompt(highlightCode('bash', line), '$') + const htmlLine = line + // replacePrompt(highlightCode('bash', line), '$') return htmlToReact(htmlLine) } @@ -190,9 +195,9 @@ function formatCode(html, lang, prompt) { .split('\n') .map((line, i) => { let newLine = prompt ? replacePrompt(line, prompt, i === 0) : line - if (lang === 'diff' && !line.startsWith('<')) { - newLine = highlightCode('python', line) - } + // if (lang === 'diff' && !line.startsWith('<')) { + // newLine = highlightCode('python', line) + // } return newLine }) .join('\n') @@ -219,26 +224,26 @@ export class Code extends React.Component { children: PropTypes.node, } - updateJuniper() { - if (this.state.Juniper == null && window.Juniper !== null) { - this.setState({ Juniper: window.Juniper }) - } - } + // updateJuniper() { + // if (this.state.Juniper == null && window.Juniper !== null) { + // this.setState({ Juniper: window.Juniper }) + // } + // } - componentDidMount() { - this.updateJuniper() - } + // componentDidMount() { + // this.updateJuniper() + // } - componentDidUpdate() { - this.updateJuniper() - } + // componentDidUpdate() { + // this.updateJuniper() + // } render() { const { lang, title, executable, github, prompt, wrap, highlight, className, children } = this.props - const codeClassNames = classNames(classes['code'], className, `language-${lang}`, { - [classes['wrap']]: !!highlight || !!wrap || lang === 'cli', - [classes['cli']]: lang === 'cli', + const codeClassNames = classNames(classes.code, className, `language-${lang}`, { + [classes.wrap]: !!highlight || !!wrap || lang === 'cli', + [classes.cli]: lang === 'cli', }) const ghClassNames = classNames(codeClassNames, classes['max-height']) const { Juniper } = this.state @@ -255,10 +260,11 @@ export class Code extends React.Component { } const codeText = Array.isArray(children) ? children.join('') : children || '' - const highlightRange = highlight ? rangeParser.parse(highlight).filter((n) => n > 0) : [] + // const highlightRange = highlight ? rangeParser.parse(highlight).filter((n) => n > 0) : [] const rawHtml = ['none', 'cli'].includes(lang) ? codeText - : highlightCode(lang, codeText, highlightRange) + : // highlightCode(lang, codeText, highlightRange) + codeText const html = formatCode(rawHtml, lang, prompt) return ( <> diff --git a/website/src/components/dropdown.js b/website/src/components/dropdown.js index 6ac8ce248..5338d2972 100644 --- a/website/src/components/dropdown.js +++ b/website/src/components/dropdown.js @@ -1,7 +1,7 @@ import React from 'react' import PropTypes from 'prop-types' import classNames from 'classnames' -import { navigate } from 'gatsby' +// import { navigate } from 'gatsby' import * as classes from '../styles/dropdown.module.sass' @@ -11,7 +11,7 @@ export default function Dropdown({ defaultValue, className, onChange, children } if (isExternal) { window.location.href = target.value } else { - navigate(target.value) + // navigate(target.value) } } return ( diff --git a/website/src/components/github.js b/website/src/components/github.js index ef5110ac2..72363c9ef 100644 --- a/website/src/components/github.js +++ b/website/src/components/github.js @@ -1,7 +1,7 @@ import React, { useState, useEffect } from 'react' import PropTypes from 'prop-types' import classNames from 'classnames' -import highlightCode from 'gatsby-remark-prismjs/highlight-code.js' +// import highlightCode from 'gatsby-remark-prismjs/highlight-code.js' import Icon from './icon' import Link from './link' @@ -39,7 +39,11 @@ const GitHubCode = ({ url, lang, errorMsg = defaultErrorMsg, className }) => { } }, [initialized, rawUrl, errorMsg]) - const highlighted = lang === 'none' || !code ? code : highlightCode(lang, code) + const highlighted = + lang === 'none' || !code + ? code + : // highlightCode(lang, code) + null return ( <> diff --git a/website/src/components/layout/index.js b/website/src/components/layout/index.js index 921081e7d..76cd3b3da 100644 --- a/website/src/components/layout/index.js +++ b/website/src/components/layout/index.js @@ -1,5 +1,6 @@ import React from 'react' import PropTypes from 'prop-types' +// import { graphql } from 'gatsby' import useOnlineStatus from '@rehooks/online-status' import classNames from 'classnames' diff --git a/website/src/components/layout/models.js b/website/src/components/layout/models.js index 7234f73b8..0e24d1982 100644 --- a/website/src/components/layout/models.js +++ b/website/src/components/layout/models.js @@ -318,7 +318,7 @@ const Model = ({ {meta.notes & } - {hasInteractiveCode && ( + {/* {hasInteractiveCode && ( {[ `import spacy`, @@ -331,7 +331,7 @@ const Model = ({ ` print(token.text, token.pos_, token.dep_)`, ].join('\n')} - )} + )} */} {meta.accuracy && ( diff --git a/website/src/components/link.js b/website/src/components/link.js index e6564a50c..22475d2af 100644 --- a/website/src/components/link.js +++ b/website/src/components/link.js @@ -1,6 +1,6 @@ import React, { Fragment } from 'react' import PropTypes from 'prop-types' -import { Link as GatsbyLink } from 'gatsby' +// import { Link as GatsbyLink } from 'gatsby' import classNames from 'classnames' import Icon from './icon' diff --git a/website/src/components/quickstart.js b/website/src/components/quickstart.js index cbeb08eee..6aa4ae752 100644 --- a/website/src/components/quickstart.js +++ b/website/src/components/quickstart.js @@ -117,10 +117,10 @@ const Quickstart = ({ const dropdownGetter = showDropdown[id] || (() => true) return hidden ? null : (
- + */}
{title} {help && ( diff --git a/website/src/components/search.js b/website/src/components/search.js index be514181f..bd543629e 100644 --- a/website/src/components/search.js +++ b/website/src/components/search.js @@ -7,23 +7,23 @@ import * as classes from '../styles/search.module.sass' export default function Search({ id = 'docsearch', placeholder = 'Search docs', settings = {} }) { const { apiKey, indexName, appId } = settings - if (!apiKey && !indexName) return null const [initialized, setInitialized] = useState(false) useEffect(() => { if (!initialized) { setInitialized(true) - window.docsearch({ - appId, - apiKey, - indexName, - inputSelector: `#${id}`, - debug: false, - }) + // window.docsearch({ + // appId, + // apiKey, + // indexName, + // inputSelector: `#${id}`, + // debug: false, + // }) } }, [initialized, apiKey, indexName, id]) + if (!apiKey && !indexName) return null return (
-