Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit 61930ff

Browse files
fix(highlight-code): fix duplicate code
1 parent d72aa0b commit 61930ff

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

webcomponents/highlight-code/src/components/highlight-code/deckdeckgo-highlight-code.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,14 @@ export class DeckdeckgoHighlightCode {
174174

175175
private parseCode(code: string): Promise<void> {
176176
return new Promise<void>(async (resolve, reject) => {
177-
178177
const container: HTMLElement = this.el.shadowRoot.querySelector('div.deckgo-highlight-code-container');
179178

180179
if (container) {
181180
try {
182181
if (this.lineNumbers) {
182+
// clear the container first
183+
container.children[0].innerHTML = '';
184+
183185
// split the code on linebreaks
184186
const regEx = RegExp(/\n(?!$)/g); //
185187
const match = code.split(regEx);

0 commit comments

Comments
 (0)