mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-08-08 06:55:26 +02:00
solution through split func
This commit is contained in:
parent
1d68aade90
commit
7b78ff85a0
4 changed files with 13 additions and 12 deletions
2
public/dist/code-styling.bundle.js
vendored
2
public/dist/code-styling.bundle.js
vendored
File diff suppressed because one or more lines are too long
12
public/dist/editor.bundle.js
vendored
12
public/dist/editor.bundle.js
vendored
File diff suppressed because one or more lines are too long
4
public/dist/main.bundle.js
vendored
4
public/dist/main.bundle.js
vendored
File diff suppressed because one or more lines are too long
|
@ -49,10 +49,11 @@ export default class CodeStyler {
|
||||||
Array.from(codeBlocks).forEach(block => {
|
Array.from(codeBlocks).forEach(block => {
|
||||||
hljs.highlightBlock(block);
|
hljs.highlightBlock(block);
|
||||||
|
|
||||||
let temp = block.innerHTML.replace(/\n([+].*)/ig, '\n<span class="diff diff--added">$1</span>');
|
let temp = block.innerHTML.split('\n');
|
||||||
|
|
||||||
temp = temp.replace(/\n([-].*)/ig, '\n<span class="diff diff--removed">$1</span>');
|
temp = temp.map(str => str.replace(/^(\+.*)$/ig, '<span class="diff diff--added">$1</span>'));
|
||||||
block.innerHTML = temp;
|
temp = temp.map(str => str.replace(/^(-.*)$/ig, '<span class="diff diff--removed">$1</span>'));
|
||||||
|
block.innerHTML = temp.join('\n');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue