Function: copyCode()
ts
function copyCode(code, language?): Promise<boolean>;Copies a code snippet to the clipboard as both HTML and plain text.
Parameters
| Parameter | Type | Description |
|---|---|---|
code | string | The code string to copy. |
language? | string | Optional language hint for the class attribute on the <code> element. |
Returns
Promise<boolean>
true when the copy succeeded.
Example
ts
console.log(await copyCode('const x = 1', 'javascript'))Since
1.0.0