2022-11-15 12:24:31 +01:00
|
|
|
import {Component} from "./component";
|
2020-01-18 15:03:11 +01:00
|
|
|
|
2022-11-15 12:24:31 +01:00
|
|
|
export class CodeHighlighter extends Component{
|
|
|
|
|
|
|
|
setup() {
|
|
|
|
const container = this.$el;
|
|
|
|
|
|
|
|
const codeBlocks = container.querySelectorAll('pre');
|
2022-02-08 12:10:01 +01:00
|
|
|
if (codeBlocks.length > 0) {
|
|
|
|
window.importVersioned('code').then(Code => {
|
2022-11-15 12:24:31 +01:00
|
|
|
Code.highlightWithin(container);
|
2022-02-08 12:10:01 +01:00
|
|
|
});
|
|
|
|
}
|
2020-01-18 15:03:11 +01:00
|
|
|
}
|
|
|
|
|
2022-11-15 12:24:31 +01:00
|
|
|
}
|