docs: fix table-of-contents generation (#3840)

This commit is contained in:
Andrey Lushnikov 2020-09-10 15:14:00 -07:00 committed by GitHub
parent 25b199b40a
commit 45542a5334
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View file

@ -690,7 +690,7 @@ page.removeListener('request', logRequest);
```
<!-- GEN:toc -->
- [event: '_videostarted'](#event-videostarted)
- [event: '_videostarted'](#event-_videostarted)
- [event: 'close'](#event-close-1)
- [event: 'console'](#event-console)
- [event: 'crash'](#event-crash)

View file

@ -15,7 +15,7 @@ configurations for common CI providers.
* [Bitbucket Pipelines](#bitbucket-pipelines)
* [GitLab CI](#gitlab-ci)
- [Caching browsers](#caching-browsers)
- [Exception: `node_modules` are cached](#exception-nodemodules-are-cached)
- [Exception: `node_modules` are cached](#exception-node_modules-are-cached)
- [Directories to cache](#directories-to-cache)
- [Debugging browser launches](#debugging-browser-launches)
- [Running headful](#running-headful)
@ -102,7 +102,7 @@ Suggested configuration
Chromium in non-headless mode (e.g. to test Chrome Extensions)
1. If your project does not have `package-lock.json`, Travis would be auto-caching
`node_modules` directory. If you run `npm install` (instead of `npm ci`), it is
possible that the browser binaries are not downloaded. Fix this with [these steps](#exception-nodemodules-are-cached) outlined below.
possible that the browser binaries are not downloaded. Fix this with [these steps](#exception-node_modules-are-cached) outlined below.
To sum up, your `.travis.yml` might look like this:

View file

@ -90,7 +90,7 @@ function getTOCEntriesForText(text) {
for (const {line, offset} of titles) {
const [, nesting, name] = line.match(titleRegex);
const delinkifiedName = name.replace(/\[([^\]]+)\]\([^)]+\)/g, '$1');
const id = delinkifiedName.trim().toLowerCase().replace(/\s/g, '-').replace(/[^-0-9a-zа-яё]/ig, '');
const id = delinkifiedName.trim().toLowerCase().replace(/\s/g, '-').replace(/[^-_0-9a-zа-яё]/ig, '');
let dedupId = id;
let counter = 0;
while (ids.has(dedupId))