BookStack/resources/js/components/code-highlighter.js

16 lines
379 B
JavaScript
Raw Normal View History

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