You can learn more about embedded code snippets on the official GitHub blog post Introducing Embedded Code Snippets. Embedded code snippets are a great productivity improvement for me, as I spend a good chunk of time reviewing others’ code and working through internal issues and bugs.Īnother benefit of embedded snippets is they link back to the original file and show a nicely formatted code block with contexts such as line numbers and file name, so you know which file is being shared without any explanation on your part. I’ve shared highlighted lines manually for some time now, and it has always been a pain to copy the code and paste it in a pull request or issue. If you keep holding shift and clicking line numbers below the original, the UI will further highlight lines. You can highlight a line by clicking the line number in the gutter of the file. Now when you highlight lines, GitHub provides a menu allowing you to copy the selected lines, copy the, and open a new issue which contains the embedded code.Īnother neat trick I discovered while learning about this new feature is the ability to highlight a line while looking at a file on, then using Shift+Click to highlight a selection of the original line and the last line clicked. Online Code Snippets Online tool works well on Windows, MAC, Linux, Chrome, Firefox, Edge, and Safari. It stores data in database with unique ID and can be deleted. It's easy to use and very unique tool to share code. For example, if you want to highlight lines 10-15, you would append #L10-L15 to the URL. What can you do with Share Code Snippets It helps users to share the code with others with auto delete functionality. Create a library or libraries out of the common code, and link them (statically or dynamically) with the different projects. GitHub rolled out embedded code snippets this month which should make it easier to share existing code without having to re-create it in a comment.įor a while, GitHub has had the ability to highlight lines with a URL hash.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |