--- title: Sharing Code with Markdown id: 747 html_url: "https://acmcsuf.com/blog/747" discussion_url: "https://github.com/EthanThatOneKid/acmcsuf.com/discussions/747" author: "jjoeldaniel (https://github.com/jjoeldaniel)" labels: [] created: "2022-12-28T01:16:19.000Z" edited: "2023-02-27T04:38:05.000Z" --- Sharing Code with Markdown ========================== INTRODUCTION The purpose of this blog post is to introduce developers to the use of Markdown for sharing code with others and explores alternative tools like Pastebin and Privatebin. This is specifically oriented towards use on Discord, however any site that supports Markdown's extended syntax elements [https://www.markdownguide.org/extended-syntax/] will also work. STRUCTURING Before anyone can dive into reviewing your code, it has to actually be readable and structured clearly. > This means not submitting this when asking for help code [https://camo.githubusercontent.com/b16bcc2c7de98fdec06f108bece95d1845753ba7c80c49afdd04fb313199f672/68747470733a2f2f616b2e706963646e2e6e65742f7368757474657273746f636b2f766964656f732f32343839363735302f7468756d622f31322e6a70673f69703d78343830]https://camo.githubusercontent.com/b16bcc2c7de98fdec06f108bece95d1845753ba7c80c49afdd04fb313199f672/68747470733a2f2f616b2e706963646e2e6e65742f7368757474657273746f636b2f766964656f732f32343839363735302f7468756d622f31322e6a70673f69703d78343830 Typically, the best way to directly post your code is with fenced code blocks [https://www.markdownguide.org/extended-syntax/#fenced-code-blocks] from Markdown. Instead of posting a wall of text, we can use these blocks to structure our code in a nice, easy-to-understand way (we even have access to syntax highlighting). EXAMPLE: > In this case, the language is JSON, replace json with the actual language you are using ```json { "firstName": "John", "lastName": "Smith", "age": 25 } ``` ...would produce: { "firstName": "John", "lastName": "Smith", "age": 25 } This way we can directly post our code. However, it's not always the best solution for large chunks of code. For this, I would recommend tools such as Pastebin [https://pastebin.com/] or Privatebin [https://privatebin.net/]. Of course, if your code is already on GitHub, feel free to link that too! You can find an example of Pastebin in action here [https://pastebin.com/qzBQxvwb]. SUMMARY This blog post provides useful tips for developers looking to share their code with others in a clear and organized way, using the tools and features of Markdown. Hopefully, you've learned a thing or two about Markdown! RESOURCES * Markdown Guide [https://www.markdownguide.org/extended-syntax/] * Pastebin [https://pastebin.com/] * Privatebin [https://privatebin.net/]