-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: respect the top-level
copyButtons
option (#990)
| 🎫 Resolves RM-10635 | 🐙 Closes #964 | | :------------------: | :------------: | ## 🧰 Changes The main `RMDX.compile()` method should respect the `copyButtons` param when rendering our code block components. - [x] **Accept the `copyButtons` option**—we used to set this param directly on our custom Unified `processor`, but since Remark actually freeze's it's processor instance we can achieve a similar effect by [passing it directly to the `CodeTabsTransformer` plugin as a configuration option](https://github.com/readmeio/markdown/blob/96f9644f04e6d8e3ffff6f9c014432f901c0b804/lib/compile.ts#L28): https://github.com/readmeio/markdown/blob/96f9644f04e6d8e3ffff6f9c014432f901c0b804/lib/compile.ts#L28 - [x] Add a <kbd>**Copy Buttons**</kbd> toggle to the dev playground.[^1] - [x] Miscellaneous detailing and minor cleanup. ## 🧬 QA & Testing Pull this PR down, run the `start` script, and [navigate to the “Code Blocks” example](http://localhost:9966/#/codeBlockTests?copyButtons=true "View local dev playground→"). Try hovering over a code block to verify that the copy button is only shown if/when the <kbd>**Copy Buttons**</kbd> toggle is checked. [demo]: https://markdown-pr-PR_NUMBER.herokuapp.com [prod]: https://SUBDOMAIN.readme.io [icn]: https://user-images.githubusercontent.com/886627/160426047-1bee9488-305a-4145-bb2b-09d8b757d38a.svg [^1]: @kellyjosephprice—do we even respect those other two global config options? I think `safeMode` and `lazyImages` both have toggles in the playground, but [there are a bunch of others which I'm not sure are still valid](https://github.com/readmeio/markdown/blob/b9502adb306f099cd91e005df17c0be252019814/options.js#L1-L22) either? Anyways, just an aside, but it would be nice to clean this all up at some point! --------- Co-authored-by: Trisha Le <[email protected]>
- Loading branch information
1 parent
1c8fc01
commit 1242413
Showing
6 changed files
with
87 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters