Skip to content

Commit

Permalink
Merge branch 'develop' into upgrade-caniuse-lit
Browse files Browse the repository at this point in the history
  • Loading branch information
Koooooo-7 authored Sep 19, 2022
2 parents d4056b6 + c98fda7 commit d97cc5d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 10 deletions.
6 changes: 3 additions & 3 deletions docs/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ Similar to [GitBook](https://www.gitbook.com), you can deploy files to GitHub Pa
There are three places to populate your docs for your GitHub repository:

- `docs/` folder
- master branch
- main branch
- gh-pages branch

It is recommended that you save your files to the `./docs` subfolder of the `master` branch of your repository. Then select `master branch /docs folder` as your GitHub Pages source in your repository's settings page.
It is recommended that you save your files to the `./docs` subfolder of the `main` branch of your repository. Then select `main branch /docs folder` as your GitHub Pages source in your repository's settings page.

![GitHub Pages](_images/deploy-github-pages.png)

!> You can also save files in the root directory and select `master branch`.
!> You can also save files in the root directory and select `main branch`.
You'll need to place a `.nojekyll` file in the deploy location (such as `/docs` or the gh-pages branch)

## GitLab Pages
Expand Down
15 changes: 8 additions & 7 deletions src/plugins/search/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,15 @@ export function search(query) {
}

const matchContent =
handlePostContent &&
'...' +
handlePostContent
.substring(start, end)
.replace(
regEx,
word => `<em class="search-keyword">${word}</em>`
) +
'...';
handlePostContent
.substring(start, end)
.replace(
regEx,
word => `<em class="search-keyword">${word}</em>`
) +
'...';

resultStr += matchContent;
}
Expand Down
20 changes: 20 additions & 0 deletions test/e2e/search.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,24 @@ test.describe('Search Plugin Tests', () => {
await searchFieldElm.fill('hello');
await expect(resultsHeadingElm).toHaveText('Changelog Title');
});
test('search when there is no body', async ({ page }) => {
const docsifyInitConfig = {
markdown: {
homepage: `
# EmptyContent
---
---
`,
},
scriptURLs: ['/lib/plugins/search.min.js'],
};

const searchFieldElm = page.locator('input[type=search]');
const resultsHeadingElm = page.locator('.results-panel h2');

await docsifyInit(docsifyInitConfig);

await searchFieldElm.fill('empty');
await expect(resultsHeadingElm).toHaveText('EmptyContent');
});
});

0 comments on commit d97cc5d

Please sign in to comment.