Fermain / -mollify

9 stars 9 forks source link

Copy paste functionality for code blocks #122

Closed Fermain closed 10 months ago

Fermain commented 1 year ago

Wrap code blocks in a svelte element (or use remark plugin) to create a button allowing for copy/pasting of markdown code blocks.

Fermain commented 10 months ago

Whoever takes this task, please do some additional research on any other way we can jazz up code blocks.

Fermain commented 10 months ago
image
Fermain commented 10 months ago

Suggest using a remark plugin.

StianSto commented 10 months ago

Who would have thought making a single button would be this hard 😆

i have made a viable product that utilizes sketons own CodeBlock component together with a custom remark plugin. we can create our own component in the future as well 😄

Screenshot 2023-09-13 124142

BUT there are still a few limitations that i think we can iron out before i push the code. to make this work we need to import the component to the +page.md file we are in. im open to any ideas to have we can do this better, to minimize the work for content creators Screenshot 2023-09-13 133347

what is so nice about this method is that it is now very easy to create other custom components, if we can figure out how to do the imports in a nice and stressfree way. it is technically possible to just write in the .md file, but i gather that it is best to keep it as native markdown if possible