Docs: fix doc search (#13164)

* fix doc search

* upgrade website node to 16

* change website travis script

* move spellcheck notification

* explicit path to npm bin

* cd to the correct place
This commit is contained in:
Vadim Ogievetsky 2022-10-03 16:48:13 -07:00
parent f0cef36abf
commit d1ec609ea2
8 changed files with 18747 additions and 2750 deletions

View File

@ -394,21 +394,14 @@ jobs:
- name: "docs"
stage: Tests - phase 1
install: ./check_test_suite.py && travis_terminate 0 || (cd website && nvm install 12.22.12 && npm install)
script: |-
(cd website && npm run lint && npm run spellcheck) || { echo "
If there are spell check errors:
1) Suppressing False Positives: Edit website/.spelling to add suppressions. Instructions
are at the top of the file and explain how to suppress false positives either globally or
within a particular file.
2) Running Spell Check Locally: cd website && npm install && npm run spellcheck
For more information, refer to: https://www.npmjs.com/package/markdown-spellcheck
" && false; }
before_script:
- ./check_test_suite.py && travis_terminate 0 || echo 'Starting nvm install...'
- nvm install 16.17.0
- (cd website && npm install)
script:
- cd website
- npm run link-lint
- npm run spellcheck
- name: "Build and test on ARM64 CPU architecture (1)"
stage: Tests - phase 2

21347
website/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,24 +3,24 @@
"scripts": {
"examples": "docusaurus-examples",
"start": "docusaurus-start",
"build": "docusaurus-build && node script/do-redirects.js",
"build": "npm run compile-scss && docusaurus-build && node script/do-redirects.js && node script/fix-docsearch.js",
"publish-gh-pages": "docusaurus-publish",
"write-translations": "docusaurus-write-translations",
"version": "docusaurus-version",
"rename-version": "docusaurus-rename-version",
"compile-scss": "node-sass scss/custom.scss > static/css/custom.css",
"link-lint": "docusaurus-build && node script/link-lint.js",
"lint": "npm run link-lint",
"spellcheck": "mdspell --en-us --ignore-numbers --report '../docs/**/*.md'"
"link-lint": "npm run build && node script/link-lint.js",
"spellcheck": "mdspell --en-us --ignore-numbers --report '../docs/**/*.md' || (./script/notify-spellcheck-issues && false)"
},
"engines": {
"node": ">=12"
"node": ">=16"
},
"volta": {
"node": "12.22.12"
"node": "16.17.0",
"npm": "8.15.0"
},
"devDependencies": {
"docusaurus": "^1.14.4",
"docusaurus": "^1.14.7",
"markdown-spellcheck": "^1.3.1",
"node-sass": "^7.0.0"
},

View File

@ -0,0 +1,45 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const replace = require('replace-in-file');
try {
// Force upgrade to docusearch 2 as 1 appers to have stopped being supported
replace.sync({
files: './build/ApacheDruid/docs/**/*.html',
from: 'https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js',
to: 'https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js',
});
replace.sync({
files: './build/ApacheDruid/docs/**/*.html',
from: 'https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css',
to: 'https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css',
});
replace.sync({
files: './build/ApacheDruid/css/main.css',
from: 'ul li a',
to: 'ul li > a',
});
console.log(`Fixed docsearch`);
} catch (error) {
console.error('Error occurred:', error);
process.exit(1);
}

View File

@ -0,0 +1,29 @@
#!/bin/bash -eu
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
echo "
If there are spell check errors:
1) Suppressing False Positives: Edit website/.spelling to add suppressions. Instructions
are at the top of the file and explain how to suppress false positives either globally or
within a particular file.
2) Running Spell Check Locally: cd website && npm install && npm run spellcheck
For more information, refer to: https://www.npmjs.com/package/markdown-spellcheck
"

View File

@ -31,29 +31,20 @@ $link: #4460de;
margin: 0;
}
.navigationSlider .slidingNav ul li a {
.navigationSlider .slidingNav ul li > a {
color: #9caeff;
font-weight: 600;
font-size: 15px;
}
.navigationSlider .slidingNav ul li:last-child a {
display: inline-block;
height: 32px;
line-height: 32px;
background: #9caeff;
border-radius: 2px;
padding: 0 10px;
color: #1C1C26;
font-weight: 600;
min-width: 106px;
text-align: center;
}
.toc .toggleNav .navGroup .navGroupSubcategoryTitle {
color: #717171;
}
.algolia-autocomplete .algolia-docsearch-footer {
display: none;
}
pre code {
max-height: 500px;
}

View File

@ -103,7 +103,8 @@ const siteConfig = {
editUrl: 'https://github.com/apache/druid/edit/master/docs/',
algolia: {
apiKey: '2de99082a9f38e49dfaa059bbe4c901d',
appId: 'CPK9PMSCEY',
apiKey: 'd4ef4ffe3a2f0c7d1e34b062fd98736b',
indexName: 'apache_druid',
algoliaOptions: {
facetFilters: [

View File

@ -25,26 +25,17 @@
height: 42px;
margin: 0; }
.navigationSlider .slidingNav ul li a {
.navigationSlider .slidingNav ul li > a {
color: #9caeff;
font-weight: 600;
font-size: 15px; }
.navigationSlider .slidingNav ul li:last-child a {
display: inline-block;
height: 32px;
line-height: 32px;
background: #9caeff;
border-radius: 2px;
padding: 0 10px;
color: #1C1C26;
font-weight: 600;
min-width: 106px;
text-align: center; }
.toc .toggleNav .navGroup .navGroupSubcategoryTitle {
color: #717171; }
.algolia-autocomplete .algolia-docsearch-footer {
display: none; }
pre code {
max-height: 500px; }