Comments (10)
I would be willing to take this on. Playing around with it its relatively easy to hide the button using CSS for anything that isn't bash using a class selector and display:none:
pre.highlight:not(.language-bash) + .toolbar {
display: none;
}
The one annoying thing with that is that we are still running the code in all cases, just hiding the output of it
from theodinproject.
Thanks for the suggestion @damon314159, I agree it makes a lot of sense having the snippets on installations copyable.
I remember this coming up before, either on Discord or on Github, and we were reluctant to add it to every lesson.
IIRC adding a copy button would make it easier to copy and paste, and we wanted to encourage leaners to type out the code snippets in the programming lessons. Theres value in typing it out, making mistakes and debugging them. It builds a lot of muscle memory and gives learners a better feel of how the code works.
But... that might be old school kind of thinking. I'd appreciate some thoughts on this. I'm happy to go with whatever the consensus is.
In short: it would be easier to add the clipboard button site wide for every lesson. But if that isn't something we want, we'll need to figure out a way to enable it for specific (installation) lessons - still very doable.
from theodinproject.
Maybe we could implement for codeblocks set to the bash
language only? This way we'd be targeting the stuff mostly used for install commands and not actual code snippets.
from theodinproject.
I think there is still added value in typing even bash commands, as it forces you to think about the structure of a command.
from theodinproject.
I think if a person intends to copy it, they're going to select and copy it regardless. This would only be a QoL change in that regard.
I can see the argument for only applying it to bash - that makes sense to me.
Perhaps a note box when the idea of coding along is introduced that typing code yourself builds memory
from theodinproject.
Targeting bash only blocks is a great idea to get this started.
I've been doing a little research to hopefully help whoever picks this up. Prism have a copy-to-clipboard plugin we can use: https://prismjs.com/plugins/copy-to-clipboard/
We include new Prism plugins in our .babelrc file, we'll need something like this:
"plugins": ["line-numbers", "toolbar", "copy-to-clipboard"]
After that, the rest should hopefully be manageable with CSS ๐ค
from theodinproject.
Thanks @Asartea, I've assigned to you.
from theodinproject.
Okay stupid question: how do I get CSS changes to show up? I inserted the above line into prism-theme.css, but running the app locally doesn't actually seem to reflect that change. I tried restarting foreman
, as well as clobbering the CSS (via rails css:clobber
)
from theodinproject.
That should have done it. But try running rails assets:clobber
, I think its a bit more thorough.
from theodinproject.
Ah that did it
from theodinproject.
Related Issues (20)
- Bug: Markdown preview tool does not render dropdowns and summaries HOT 2
- Bug: Markdown preview doesn't work with <details> tag HOT 3
- Suggestion: Change links to 'unvisited' once a lesson has been unmarked as complete HOT 3
- Add โContinueโ button and badge for selected path HOT 10
- Bug: EJS syntax highlighting not supported HOT 1
- Chore: Additional Prism language support HOT 2
- Feature Request: Level 4 headings render h4 > a with fragment (and id) HOT 9
- Chore: Wiki/Reflections from a Rails-newcomer HOT 5
- Feature Request: Link the markdown preview tool somewhere in the website itself
- Bug: <outdated hyperlinks of faq page> HOT 3
- Add Feature Flag HOT 1
- UI: draft requirements HOT 2
- Backend: Draft Requirements
- Database: Draft Requirements
- Backend: Get wordlist for predefined options
- Frontend: learn enough about Stimulus to use 'Slim Select' for the multi-select
- Next lesson button doesn't lead to the beginning of the next lesson. HOT 4
- Feature Request: Reword the rules regarding DMs HOT 2
- <All paths Interface>: <Correct number of lessons in all paths interface> HOT 5
- Media Queries: <Short description of your suggestion> HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from theodinproject.