chore(v2): fix code style

This commit is contained in:
Alexey Pyltsyn 2020-04-05 17:27:03 +03:00
parent b07507c9cc
commit 6965a668cd
143 changed files with 458 additions and 457 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);
}