Skip to content

Commit

Permalink
Merge pull request #771 from zhensherlock/dev
Browse files Browse the repository at this point in the history
ci: add algolia
  • Loading branch information
zhensherlock authored Sep 18, 2024
2 parents 0f5f1fc + e643052 commit 93b6932
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 28 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/algolia.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: algolia
on:
push:
branches:
- main
jobs:
algolia:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get the content of algolia.json as config
id: algolia_config
run: echo "config=$(cat crawlerConfig.json | jq -r tostring)" >> $GITHUB_OUTPUT
- name: Push indices to Algolia
uses: signcl/docsearch-scraper-action@master
env:
APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
CONFIG: ${{ steps.algolia_config.outputs.config }}
33 changes: 33 additions & 0 deletions crawlerConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"index_name": "company-autocomplete-docs",
"start_urls": ["https://zhensherlock.github.io/company-autocomplete/"],
"rateLimit": 8,
"maxDepth": 10,
"selectors": {
"lvl0": {
"selector": "",
"defaultValue": "Documentation"
},
"lvl1": ".content h1",
"lvl2": ".content h2",
"lvl3": ".content h3",
"lvl4": ".content h4",
"lvl5": ".content h5",
"content": ".content p, .content li",
"lang": {
"selector": "/html/@lang",
"type": "xpath",
"global": true
}
},
"selectors_exclude": [
"aside",
".page-footer",
".next-and-prev-link",
".table-of-contents"
],
"custom_settings": {
"attributesForFaceting": ["lang", "tags"]
},
"js_render": true
}
10 changes: 5 additions & 5 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ export default {
}
]
},
// algolia: {
// appId: 'V6CF28P0PS',
// apiKey: '692752b7b3c6f794997d8ae22aed79fa',
// indexName: 'dev_docs'
// },
algolia: {
appId: 'V6CF28P0PS',
apiKey: '692752b7b3c6f794997d8ae22aed79fa',
indexName: 'company-autocomplete-docs'
},
footer: {
message: 'Released under the MIT License.',
copyright: 'Copyright © 2021-present Michael Sun'
Expand Down
6 changes: 3 additions & 3 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import DefaultTheme from 'vitepress/theme'
import ElementPlus from 'element-plus'
import './custom-theme.scss'
import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/dark/css-vars.css'

export default {
...DefaultTheme,
enhanceApp: async ({ app, router, siteData, isServer }: any) => {
// app is the Vue 3 app instance from `createApp()`. router is VitePress'
// custom router. `siteData`` is a `ref`` of current site-level metadata.
import('element-plus').then((module) => {
app.use(module)
})
app.use(ElementPlus)
}
}
29 changes: 19 additions & 10 deletions docs/guide/example.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,27 @@ const companyAutocomplete = new CompanyAutocomplete({
})
```

## QCC Open API
<div id="qcc_open_input">
</div>
[//]: # (## QCC Open API)

```js
import { CompanyAutocomplete } from 'company-autocomplete'
[//]: # (<div id="qcc_open_input">)

const companyAutocomplete = new CompanyAutocomplete({
api: 'qcc_open',
target: '#example'
})
```
[//]: # (</div>)

[//]: # ()
[//]: # (```js)

[//]: # (import { CompanyAutocomplete } from 'company-autocomplete' )

[//]: # ()
[//]: # (const companyAutocomplete = new CompanyAutocomplete&#40;{)

[//]: # ( api: 'qcc_open',)

[//]: # ( target: '#example')

[//]: # (}&#41;)

[//]: # (```)

[//]: # (## QCC Global API)

Expand Down
29 changes: 19 additions & 10 deletions docs/zh/guide/example.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,27 @@ const companyAutocomplete = new CompanyAutocomplete({
})
```

## QCC Open API
<div id="qcc_open_input">
</div>
[//]: # (## QCC Open API)

```js
import { CompanyAutocomplete } from 'company-autocomplete'
[//]: # (<div id="qcc_open_input">)

const companyAutocomplete = new CompanyAutocomplete({
api: 'qcc_open',
target: '#example'
})
```
[//]: # (</div>)

[//]: # ()
[//]: # (```js)

[//]: # (import { CompanyAutocomplete } from 'company-autocomplete')

[//]: # ()
[//]: # (const companyAutocomplete = new CompanyAutocomplete&#40;{)

[//]: # ( api: 'qcc_open',)

[//]: # ( target: '#example')

[//]: # (}&#41;)

[//]: # (```)

[//]: # (## QCC Global API)

Expand Down

0 comments on commit 93b6932

Please sign in to comment.