DEV Community

loading...

Sharing Diffs on Dev.to?

bennypowers profile image Benny Powers 🇮🇱🇨🇦 ・1 min read

Howdy,
I want to share a diff on Dev.to. How would you go about doing that?
I found a nice service called mergely, but I'm not sure if my shared diffs are writable by all, and anyways they can't be embeded. How would you share your diffs?

Discussion

pic
Editor guide
Collapse
philnash profile image
Phil Nash

You can share diffs using the regular code fences in markdown. Just start the code fence with: three backticks and then diff (I can't escape the backticks to show you 😖).

Then it will look something like this:

diff --git a/Gemfile.lock b/Gemfile.lock
index da900f1..a5c96ce 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -82,7 +82,7 @@ GEM
       railties (>= 4.1.0, < 6.0)
       responders
       warden (~> 1.2.3)
-    devise-authy (1.10.0)
+    devise-authy (1.9.0)
       authy (>= 2.7.2)
       devise (>= 3.0.0)
     erubi (1.7.1)
Collapse
bennypowers profile image
Benny Powers 🇮🇱🇨🇦 Author

That's awesome!

That will work great for simple diffs, but how would I share, say, a whole-file diff, ignoring whitespace?

Collapse
rhymes profile image
rhymes

You could use gist: