|
| 1 | +#Contributing to QuickSnip |
| 2 | + |
| 3 | +Hey there! 👋 First off, thanks for taking the time to contribute! ❤️ |
| 4 | + |
| 5 | +You can contribute in two main ways: |
| 6 | + |
| 7 | +-**Improving the code** (like fixing bugs or adding cool new features) |
| 8 | +-**Adding new code snippets** (or improving the existing ones!) |
| 9 | + |
| 10 | +--- |
| 11 | + |
| 12 | +##Improving the code |
| 13 | + |
| 14 | +If you have a feature request or want to fix a bug, feel free to: |
| 15 | + |
| 16 | +-[Open an Issue](https://github.com/dostonnabotov/sass-template/issues) to let me know what’s up. |
| 17 | +-[Send a pull request](https://github.com/dostonnabotov/sass-template/pulls) with your changes. |
| 18 | + |
| 19 | +--- |
| 20 | + |
| 21 | +##Adding Snippets |
| 22 | + |
| 23 | +###Adding to an Existing Category |
| 24 | + |
| 25 | +1.**Find the language file:** |
| 26 | + |
| 27 | +Head over to the`/public/data` folder and locate the language file you need, like javascript.json or python.json |
| 28 | + |
| 29 | +2.**Find the category:** |
| 30 | + |
| 31 | +Look for the categoryName where your snippet belongs. |
| 32 | + |
| 33 | +3.**Add your snippet** in this format: |
| 34 | + |
| 35 | +```json |
| 36 | +{ |
| 37 | +"title":"Name of the snippet", |
| 38 | +"description":"A short explanation of what the snippet does", |
| 39 | +"code":"your code goes here", |
| 40 | +"tags": ["tag1","tag2","tag3"], |
| 41 | +"author":"your_github_username" |
| 42 | +} |
| 43 | +``` |
| 44 | + |
| 45 | +Here’s an example for #"diff-eca12c0a30e25b4b46522ebf89465a03ba72a03f540796c979137931d8f92055-empty-46-0" data-selected="false" role="gridcell" tabindex="-1" valign="top"> | 46 | + |
| 47 | +```json |
| 48 | +// javascript.json |
| 49 | +[ |
| 50 | + { |
| 51 | +"categoryName":"Date and Time", |
| 52 | +"snippets": [ |
| 53 | + { |
| 54 | +"title":"Format Date", |
| 55 | +"description":"Formats a date in 'YYYY-MM-DD' format.", |
| 56 | +"code":"const formatDate = (date) => date.toISOString().split('T')[0];\n\n// Usage:\nconsole.log(formatDate(new Date())); // Output: '2024-12-10'", |
| 57 | +"tags": ["javascript","date","format"], |
| 58 | +"author":"technoph1le" |
| 59 | + } |
| 60 | + ] |
| 61 | + } |
| 62 | +] |
| 63 | +``` |
| 64 | + |
| 65 | +###Adding a New Category |
| 66 | + |
| 67 | +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). |
| 68 | + |
| 69 | +Use this format: |
| 70 | + |
| 71 | +```json |
| 72 | +[ |
| 73 | + { |
| 74 | +"categoryName":"New Category Name", |
| 75 | +"snippets": [ |
| 76 | + { |
| 77 | +"title":"Name of the snippet", |
| 78 | +"description":"A short explanation of what it does", |
| 79 | +"code":"your code goes here", |
| 80 | +"tags": ["tag1","tag2","tag3"], |
| 81 | +"author":"your_github_username" |
| 82 | + } |
| 83 | + ] |
| 84 | + } |
| 85 | +] |
| 86 | +``` |
| 87 | + |
| 88 | +###Adding a New Language |
| 89 | + |
| 90 | +Want to include a new programming language? Here's what to do: |
| 91 | + |
| 92 | +1.**Create a new file:** |
| 93 | + |
| 94 | +In the`/public/data` folder, create a file named after the language (e.g.,`go.json`). |
| 95 | + |
| 96 | +2.**Add categories and snippets:** |
| 97 | + |
| 98 | +Follow the formats explained above. |
| 99 | + |
| 100 | +3.**Update the`_index.json`:** |
| 101 | + |
| 102 | +Add your new language like this: |
| 103 | + |
| 104 | +```json |
| 105 | +[ |
| 106 | + { |
| 107 | +"lang":"Go", |
| 108 | +"icon":"/icons/go.svg" |
| 109 | + } |
| 110 | +] |
| 111 | +``` |
| 112 | + |
| 113 | +4.**Include an icon:** |
| 114 | + |
| 115 | +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. |
| 116 | + |
| 117 | +5.**Double-check your work:** |
| 118 | + |
| 119 | +Test on your side and confirm if it works properly. |
| 120 | + |
| 121 | +--- |
| 122 | + |
| 123 | +##Final Notes |
| 124 | + |
| 125 | +Whether you’re fixing a tiny typo, writing a new snippet, or dreaming up big features, every bit counts! 🛠️ |
| 126 | + |
| 127 | +If you have any questions or need help, feel free to open an issue or tag me. |
| 128 | + |
| 129 | +Happy coding! 💻✨ |