[Tools MarkDown] Create a Diff in Markdown to Show What Has Changed in a Code Snippet

ou can create diffs in markdown to show what has changed in a code snippet. I use this in blog posts to highlight changed lines for readers. This works for code snippets in most markdown packages and on Dev.to.

To show a line of code changing in a function, you can do this:

```diff
function addTwoNumbers (num1, num2) {
-  return 1 + 2
+  return num1 + num2
}
```
原文地址:https://www.cnblogs.com/Answer1215/p/13923662.html