Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
initCodeStyle() {
let codes = Omi.$$("code");
let codeHlNumArr = [];
codes.forEach(code => {
hljs.highlightBlock(code);
let arr = code.className.match(/{\S*}/);
let hllNums = null;
if (arr) {
let numArr = arr[0].replace(/[{|}]/g, '').split(',');
hllNums = this._arrToNumber(numArr);
}
codeHlNumArr.push(hllNums);
})
highlightLines();
codes.forEach((code, index) => {
this._hll(code, codeHlNumArr[index])
initCodeStyle() {
let codes = Omi.$$("code");
let codeHlNumArr = [];
codes.forEach(code => {
hljs.highlightBlock(code);
let arr = code.className.match(/{\S*}/);
let hllNums = null;
if (arr) {
let numArr = arr[0].replace(/[{|}]/g, '').split(',');
hllNums = this._arrToNumber(numArr);
}
codeHlNumArr.push(hllNums);
})
highlightLines();
codes.forEach((code, index) => {
this._hll(code, codeHlNumArr[index])
_hll(code, hllNums){
let spans = Omi.$$('.line',code);
hllNums&&hllNums.forEach(num =>{
spans[num]&&spans[num].classList.add('highlight');
})
}
_hll(code, hllNums){
let spans = Omi.$$('.line',code);
hllNums&&hllNums.forEach(num =>{
spans[num]&&spans[num].classList.add('highlight');
})
}