1
0
Fork 0
mirror of https://github.com/codex-team/codex.docs.git synced 2025-07-24 23:59:46 +02:00

Updated highlight.js (#131)

* Updated highlight.js

* Update .codexdocsrc.sample

remove undefined page for a fresh new install

Co-authored-by: Taly <vitalik7tv@yandex.ru>
This commit is contained in:
Chuyen Nguyen 2021-07-27 13:30:31 +03:00 committed by GitHub
parent 180e1d57cb
commit 077ea72906
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 46 additions and 30 deletions

View file

@ -12,5 +12,4 @@ plugins:
postcss-color-hex-alpha: {}
postcss-font-family-system-ui: {}
cssnano: {}
autoprefixer:
browsers: ['last 2 versions', '> 1%']

View file

@ -1,9 +1,9 @@
import hljs from 'highlight.js/lib/highlight';
import hljs from 'highlight.js/lib/common';
import javascript from 'highlight.js/lib/languages/javascript';
import xml from 'highlight.js/lib/languages/xml';
import json from 'highlight.js/lib/languages/json';
import css from 'highlight.js/lib/languages/css';
import style from 'highlight.js/styles/github-gist.css'; // eslint-disable-line no-unused-vars
import style from 'highlight.js/styles/github.css'; // eslint-disable-line no-unused-vars
import diffStyles from '../../styles/diff.pcss'; // eslint-disable-line no-unused-vars
/**
@ -22,7 +22,7 @@ export default class CodeStyler {
javascript,
xml,
json,
css
css,
};
this.init();
@ -43,7 +43,7 @@ export default class CodeStyler {
});
hljs.configure({
languages: this.languages
languages: this.languages,
});
Array.from(codeBlocks).forEach(block => {
@ -56,10 +56,10 @@ export default class CodeStyler {
* Highlight lines started from + or -
* @param {Element} block
*/
highlightDiffs(block){
let lines = block.innerHTML.split('\n').map((line, index) => {
highlightDiffs(block) {
const lines = block.innerHTML.split('\n').map((line, index) => {
return line.replace(/^\+(.*)$/ig, '<span class="diff diff--added">$1</span>')
.replace(/^-(.*)$/ig, '<span class="diff diff--removed">$1</span>');
.replace(/^-(.*)$/ig, '<span class="diff diff--removed">$1</span>');
});
block.innerHTML = lines.join('\n');

View file

@ -10,8 +10,7 @@ export default class Extensions {
*/
constructor() {
this.misprints = new Misprints({
chatId: window.config.misprintsChatId
chatId: window.config.misprintsChatId,
});
}
}