Skip to content

Commit

Permalink
Implement copy text content
Browse files Browse the repository at this point in the history
  • Loading branch information
Tweekism committed Feb 22, 2025
1 parent 416c33c commit d0c8356
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/parser/copycode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ export default function copycode(md: MarkdownIt) {
const defaultRender = md.renderer.rules.fence!;
md.renderer.rules.fence = (tokens, idx, options, env, self) => {
const renderedPreBlock = defaultRender(tokens, idx, options, env, self);
let content = tokens[idx].content;

Check failure on line 12 in src/parser/copycode.ts

View workflow job for this annotation

GitHub Actions / Lint

'content' is never reassigned. Use 'const' instead
return `
<div class="pre-wrapper" style="position: relative">
${renderedPreBlock}
<div class="copy-wrapper">
<button class="copy-button" data-clipboard-text="TODO: Implement proper copy content">
<button class="copy-button" data-clipboard-text="${content.replaceAll('"', '&quot;')}">
${copyIcon}
${checkIcon}
${xIcon}
Expand Down

0 comments on commit d0c8356

Please sign in to comment.