@expressive-code/plugin-frames
Advanced tools
Comparing version 0.19.2 to 0.20.0
@@ -27,2 +27,10 @@ import { StyleSettings, PluginTexts, ExpressiveCodePlugin, AttachedPluginData } from '@expressive-code/core'; | ||
showCopyToClipboardButton?: boolean | undefined; | ||
/** | ||
* If this is true (default), the "Copy to clipboard" button of terminal window frames | ||
* will remove comment lines starting with `#` from the copied text. | ||
* | ||
* This is useful to reduce the copied text to the actual commands users need to run, | ||
* instead of also copying explanatory comments or instructions. | ||
*/ | ||
removeCommentsWhenCopyingTerminalFrames?: boolean | undefined; | ||
styleOverrides?: Partial<typeof framesStyleSettings.defaultSettings> | undefined; | ||
@@ -29,0 +37,0 @@ } |
@@ -520,2 +520,3 @@ // src/index.ts | ||
showCopyToClipboardButton: true, | ||
removeCommentsWhenCopyingTerminalFrames: true, | ||
...options | ||
@@ -581,3 +582,7 @@ }; | ||
if (options.showCopyToClipboardButton) { | ||
const codeToCopy = codeBlock.code.replace(/\n/g, "\x7F"); | ||
let codeToCopy = codeBlock.code; | ||
if (options.removeCommentsWhenCopyingTerminalFrames && isTerminal) { | ||
codeToCopy = codeToCopy.replace(/(?<=^|\n)\s*#.*($|\n+)/g, "").trim(); | ||
} | ||
codeToCopy = codeToCopy.replace(/\n/g, "\x7F"); | ||
extraElements.push( | ||
@@ -584,0 +589,0 @@ h("div", { className: "copy" }, [ |
{ | ||
"name": "@expressive-code/plugin-frames", | ||
"version": "0.19.2", | ||
"version": "0.20.0", | ||
"description": "Frames plugin for Expressive Code. Wraps code blocks in a styled editor or terminal frame with support for titles, multiple tabs and more.", | ||
@@ -26,3 +26,3 @@ "keywords": [], | ||
"dependencies": { | ||
"@expressive-code/core": "^0.19.2", | ||
"@expressive-code/core": "^0.20.0", | ||
"hastscript": "^7.2.0" | ||
@@ -33,3 +33,3 @@ }, | ||
"hast-util-to-html": "^8.0.4", | ||
"@internal/test-utils": "^0.2.12" | ||
"@internal/test-utils": "^0.2.13" | ||
}, | ||
@@ -36,0 +36,0 @@ "scripts": { |
@@ -190,2 +190,12 @@ # @expressive-code/plugin-frames | ||
- `showCopyToClipboardButton: boolean` | ||
If `true` (which is the default), a "Copy to clipboard" button will be shown for each code block. | ||
- `removeCommentsWhenCopyingTerminalFrames: boolean` | ||
If `true` (which is the default), the "Copy to clipboard" button of terminal window frames will remove comment lines starting with `#` from the copied text. | ||
This is useful to reduce the copied text to the actual commands users need to run, instead of also copying explanatory comments or instructions. | ||
- `styleOverrides` | ||
@@ -192,0 +202,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
167284
1886
276
+ Added@expressive-code/core@0.20.0(transitive)
- Removed@expressive-code/core@0.19.2(transitive)