Skip to content

Commit

Permalink
chore: use unique id for markdown codeblock #2025
Browse files Browse the repository at this point in the history
  • Loading branch information
marek-mihok committed Aug 28, 2023
1 parent 6143f7b commit 6094402
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ui/src/markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ const highlightSyntax = async (str: S, language: S, codeBlockId: S) => {
const highlightedCode = language
? hljs.highlight(str, { language, ignoreIllegals: true }).value
: hljs.highlightAuto(str).value
codeBlock.outerHTML = `<code id="codeblock" class="hljs" style="position:relative;">${highlightedCode}</code>`
codeBlock.outerHTML = `<code id="${codeBlockId}" class="hljs" style="position:relative;">${highlightedCode}</code>`

const cb = document.getElementById('codeblock')
const cb = document.getElementById(codeBlockId)
if (cb) ReactDOM.render(<ClipboardCopyButton value={str} anchorElement={cb} showOnHoverOnly portal />, document.createElement('div'))
}

Expand Down

0 comments on commit 6094402

Please sign in to comment.