chore(v2): upgrade devDependencies (#2538)

* chore(v2): upgrade devDependencies

* chore(v2): upgrade devDependencies

* chore: prettier
This commit is contained in:
Yangshun Tay 2020-04-05 19:07:44 +08:00 committed by GitHub
parent ea8c916528
commit b07507c9cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
148 changed files with 2385 additions and 1975 deletions

View file

@ -20,7 +20,7 @@ const tocRegex = new RegExp('<AUTOGENERATED_TABLE_OF_CONTENTS>', 'i');
*
*/
function getTOC(content, headingTags = 'h2', subHeadingTags = 'h3') {
const tagToLevel = tag => Number(tag.slice(1));
const tagToLevel = (tag) => Number(tag.slice(1));
const headingLevels = [].concat(headingTags).map(tagToLevel);
const subHeadingLevels = subHeadingTags
? [].concat(subHeadingTags).map(tagToLevel)
@ -35,7 +35,7 @@ function getTOC(content, headingTags = 'h2', subHeadingTags = 'h3') {
const slugger = new GithubSlugger();
let current;
headings.forEach(heading => {
headings.forEach((heading) => {
const rawContent = heading.content;
const rendered = md.renderInline(rawContent);
@ -68,8 +68,8 @@ function insertTOC(rawContent) {
const filterRe = /^`[^`]*`/;
const headers = getTOC(rawContent, 'h3', null);
const tableOfContents = headers
.filter(header => filterRe.test(header.rawContent))
.map(header => ` - [${header.rawContent}](#${header.hashLink})`)
.filter((header) => filterRe.test(header.rawContent))
.map((header) => ` - [${header.rawContent}](#${header.hashLink})`)
.join('\n');
return rawContent.replace(tocRegex, tableOfContents);
}