1
0
mirror of https://github.com/phuoc-ng/csslayout.git synced 2025-10-23 02:36:11 +02:00
Files
csslayout/client/helpers/highlight.js
2019-11-15 16:36:42 +07:00

12 lines
323 B
JavaScript
Executable File

import hljs from 'highlight.js';
const highlight = (input, language) => {
const lang = language || 'html';
const { value } = hljs.highlight(lang, input);
const highlighted = value.replace('&', '&').trim();
return `<code class="hljs h-100 ${lang}">${highlighted}</code>`;
};
export default highlight;