You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Specify the language after the first set of backticks for syntax highlighting.
74
80
75
-
If your snippet doesn’t fit into any existing category, you can create a new one! Just make sure it’s unique and doesn’t overlap with others (e.g., don’t create separate categories for “Date” and “Time” when “Date and Time” works).
81
+
6.**Test your snippet:**
82
+
- Ensure your code runs as expected.
83
+
84
+
Expected file structure:
76
85
77
-
Use this format:
78
-
79
-
```json
80
-
[
81
-
{
82
-
"categoryName": "New Category Name",
83
-
"snippets": [
84
-
{
85
-
"title": "Name of the snippet",
86
-
"description": "A short explanation of what it does",
87
-
"code": [
88
-
"your code goes here",
89
-
" this is a newline with a space"
90
-
],
91
-
"tags": ["tag1", "tag2", "tag3"],
92
-
"author": "your_github_username"
93
-
}
94
-
]
95
-
}
96
-
]
86
+
```md
87
+
/snippets
88
+
|- language
89
+
|- category-name
90
+
|- your-snippet-here.md
97
91
```
98
92
99
-
### Adding a New Language
93
+
### Editing a Existing Snippet
100
94
101
-
Want to include a new programming language? Here's what to do:
95
+
If you’d like to refine or improve an existing snippet:
102
96
103
-
1.**Create a new file:**
97
+
1.**Add a `contributors` field:**
104
98
105
-
In the `/public/data` folder, create a file named after the language (e.g., `go.json`).
99
+
- Include your GitHub username under the `contributors` field in the metadata section.
106
100
107
-
2.**Add categories and snippets:**
101
+
````md
102
+
---
103
+
title: Name of the snippet
104
+
description: A short explanation of what the snippet does
105
+
tags: tag1, tag2, tag3
106
+
author: original-author
107
+
contributors: your-github-username
108
+
---
108
109
109
-
Follow the formats explained above.
110
+
```
111
+
Updated code here
112
+
```
113
+
````
110
114
111
-
3.**Update the `_index.json`:**
115
+
2.**Credit all contributors:**
112
116
113
-
Add your new language like this:
117
+
- If contributors already exist, add your username separated by a comma
Clearly indicate what you updated and why in your pull request description.
126
+
127
+
We want to make sure that original author and contributor(s) are credited for their work.
128
+
129
+
130
+
### Adding a New Category
131
+
132
+
If your snippet doesn’t fit into any existing category, you can create a new one! Just make sure it’s unique and doesn’t overlap with others (e.g., don’t create separate categories for “Date” and “Time” when “Date and Time” works).
133
+
134
+
1.**Create a new category folder:**
135
+
136
+
- In the relevant language directory, add a new folder.
137
+
- Use a lowercase name with hyphens for separation (e.g., `file-handling`).
138
+
139
+
2.**Add snippets:**
140
+
141
+
- Follow the [Adding a New Snippet](#adding-a-new-snippet) instructions.
142
+
143
+
144
+
Example structure:
145
+
146
+
```md
147
+
/snippets
148
+
|- python
149
+
|- file-handling
150
+
|- list-manipulation
151
+
|- ....
152
+
```
153
+
154
+
### Adding a New Language
155
+
156
+
If you want to introduce a new programming language, here's how to do it:
157
+
158
+
1.**Create a language folder:**
159
+
160
+
- Add a new folder under the `snippets` directory.
161
+
- Name it after the language in lowercase (e.g., `go`, `ruby`).
162
+
163
+
2.**Add categories and snippets:**
164
+
165
+
- Follow the [Adding a New Snippet](#adding-a-new-snippet) and [Adding a New Category](#adding-a-new-category) guidelines.
166
+
124
167
4.**Include an icon:**
125
168
126
-
Upload a logo for your language into the `/public/icons` folder. Make sure the filename matches the one you used in `_index.json`. Icons should be 50x50px in `.svg` format.
169
+
- Add an `icon.svg` file (50x50px) in the same language folder.
170
+
- Use tools like [Resize SVG](https://www.iloveimg.com/resize-image/resize-svg) to ensure the correct size.
127
171
128
172
5.**Double-check your work:**
129
173
130
-
Test on your side and confirm if it works properly.
174
+
- Verify that everything is structured correctly and displays as intended.
0 commit comments