Skip to content

Commit 5577871

Browse files
committed
Support alternatives in tips.
1 parent a082bb7 commit 5577871

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

.doxie.render.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,18 @@ function escapeStr(str) {
77
var render = function(data) {
88
var data = data.data;
99

10-
return [
10+
var tips = [
1111
'## ' + data.title,
1212
'```sh',
1313
data.tip,
1414
'```',
1515
'\n'
16-
].join('\n');
16+
];
17+
Array.isArray(data.alternatives) && tips.push(['__Alternatives:__']) &&
18+
data.alternatives.map(function(alternative){
19+
tips = tips.concat(['```sh',alternative,'```','\n'])
20+
});
21+
return tips.join('\n');
1722
};
1823

1924
module.exports = render;

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ git remote set-url origin <URL>
9898
git remote
9999
```
100100

101+
102+
__Alternatives:__
103+
```sh
104+
git remote show
105+
```
106+
101107
## Get list of all local and remote branches
102108
```sh
103109
git branch -a

contributing.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22

33
* [Fork](https://github.com/git-tips/tips/network) the repo.
44

5-
* Install the deps:
5+
* Install the deps:
66
```sh
77
$ cd tips && npm install
88
```
9-
9+
1010
* Edit [tips.json](./tips.json) to add your tip in the below format:
1111

1212
```js
1313
{
1414
"title": <your_tip_title>,
15-
"tip": <your_tip>
15+
"tip": <your_tip>,
16+
"alternatives": [Optional list of alternatives]
1617
}
1718
```
1819

tips.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
{
5555
"title": "Get list of all remote references",
5656
"tip": "git remote",
57-
"alternatives": "git remote show"
57+
"alternatives": ["git remote show"]
5858
},
5959
{
6060
"title": "Get list of all local and remote branches",

0 commit comments

Comments
 (0)