From 5aa663ba842c982e700f6b60193f27072ea5bff6 Mon Sep 17 00:00:00 2001 From: Tomas Kulhanek Date: Mon, 1 Feb 2021 13:58:31 +0000 Subject: [PATCH] UPDATE eslint fixes --- src/elements/markdown-book2.js | 20 +++++++++----------- src/elements/markdown-it-btoc.js | 12 +++++------- src/elements/markdownaurelia.js | 2 +- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/elements/markdown-book2.js b/src/elements/markdown-book2.js index 7b61614..d4c5de7 100644 --- a/src/elements/markdown-book2.js +++ b/src/elements/markdown-book2.js @@ -1,5 +1,5 @@ import {MarkdownBook} from './markdown-book'; -import {bindable,observable} from 'aurelia-framework'; +import {bindable, observable} from 'aurelia-framework'; export class MarkdownBook2 extends MarkdownBook { @bindable summary; @@ -20,21 +20,19 @@ export class MarkdownBook2 extends MarkdownBook { } attached() { - console.log('markdown book2 attached() toc', this.toc); + console.log('markdown book2 attached() toc', this.toc); //super.attached(); //console.log('markdownbook attached shownav', this.shownav); } - tocChanged(newValue,oldValue) { - this.mytoc.innerHTML = newValue; + tocChanged(newValue, oldValue) { + this.mytoc.innerHTML = newValue; } - scrollto(id){ - let el = document.getElementById(id); - console.log('markdownbook2 scrollto() id,el',id,el); - el.scrollIntoView(); -// document.getElementById(id).scrollIntoView(); + scrollto(id) { + let el = document.getElementById(id); + console.log('markdownbook2 scrollto() id,el', id, el); + el.scrollIntoView(); + // document.getElementById(id).scrollIntoView(); } - - } diff --git a/src/elements/markdown-it-btoc.js b/src/elements/markdown-it-btoc.js index 4fb46e4..2808089 100644 --- a/src/elements/markdown-it-btoc.js +++ b/src/elements/markdown-it-btoc.js @@ -10,15 +10,13 @@ let defaultOptions = { reverseLink: false }; -export function markdownitbtoc(md, options) { +export function markdownitbtoc(md, _options) { // Set default options - var options = Object.assign({}, defaultOptions, options); + let options = Object.assign({}, defaultOptions, _options); // Global variables - if (!headingInfos) { - var headingInfos = []; - } else { - + if (!window.headingInfos) { + window.headingInfos = []; } md.inline.ruler.after('emphasis', 'toc', function(state, silent) { @@ -53,7 +51,7 @@ export function markdownitbtoc(md, options) { // Parses all heading information to render the TOC for (let i = 0; i < tokens.length; i++) { if (tokens[i].type === 'heading_open') { - let tagLevel = parseInt(tokens[i].tag[1]); + let tagLevel = parseInt(tokens[i].tag[1], 10); let numbering = []; headingCounts[tagLevel] += 1; diff --git a/src/elements/markdownaurelia.js b/src/elements/markdownaurelia.js index bcf1c03..6d3e98d 100644 --- a/src/elements/markdownaurelia.js +++ b/src/elements/markdownaurelia.js @@ -114,7 +114,7 @@ export class Markdownaurelia { //convert from md to html this.html = this.md.render(this.text); let tocregex = /]*id="toc"[^<>]*>(.*?)<\/div>/g; - this.toc = this.md.render('@[toc] \n'+this.text).match(tocregex)[0]; + this.toc = this.md.render('@[toc] \n' + this.text).match(tocregex)[0]; console.log('readmd toc:', this.toc); this.update(); });