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

16 lines
379 B
JavaScript
Raw Normal View History

2022-11-15 11:24:31 +00:00
import {Component} from "./component";
2020-01-18 14:03:11 +00:00
2022-11-15 11:24:31 +00: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 11:24:31 +00:00
Code.highlightWithin(container);
});
}
2020-01-18 14:03:11 +00:00
}
2022-11-15 11:24:31 +00:00
}