Skip to content

Commit

Permalink
UPDATE eslint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasKulhanek committed Feb 1, 2021
1 parent 26b0f75 commit 5aa663b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
20 changes: 9 additions & 11 deletions src/elements/markdown-book2.js
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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();
}


}
12 changes: 5 additions & 7 deletions src/elements/markdown-it-btoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/elements/markdownaurelia.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class Markdownaurelia {
//convert from md to html
this.html = this.md.render(this.text);
let tocregex = /<div[^<>]*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();
});
Expand Down

0 comments on commit 5aa663b

Please sign in to comment.