Skip to content

neoRandom/quicksnip-snippet-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QuickSnip Snippet Converter

Converts a code snippet into a formatted JSON used on the QuickSnip open-source project.

Summary

Usage

Requirements

  • Python ( >= 3.9 ig; >=3.12 recommended )
  • Linux (recommended)
  • Python Virtual Environment (recommended)

Commands

  • pip install -r requirements.txt
  • cd src
  • python ./converter.py <file path> <language (optional)>

Formatting

Input

Base structure:

<category: str>
<title: str>
<description: str>
<tags: list[str]>
<author: str>

<code: list[str]>

Python example:

# SQLite Database
# Examples
# Simple Examples
# python, hello world, beginner friendly, prevents accidental execution when importing
# neoRandom

if __name__ == "__main__":
    print("Hello, world")

JavaScript example:

// Fundamentals
// Examples
// Simple Examples
// java, javascript, just kiddin they are not the same
// neoRandom

console.log("Hello, world!")

Output:

Python example (python.json):

[
  {
    "categoryName": "SQLite Database",
    "snippets": [
      {
        "title": "Examples",
        "description": "Simple Examples",
        "code": [
          "if __name__ == \"__main__\":",
          "    print(\"Hello, world\")",
          ""
        ],
        "tags": [
          "python",
          "hello world",
          "beginner friendly",
          "prevents accidental execution when importing"
        ],
        "author": "neoRandom"
      }
    ]
  }
]

Note: The only thing that change from language to language is the output file name (python.json to Python, javascript.json to JavaScript etc.).

QuickSnip

I have no relation to the project, I just liked it.

The QuickSnip project just migrated from JSON to Markdown, so this converter is decapred.

Click here to check it out

License

This project is currently under a MIT LICENSE

About

Converts a code snippet into a formatted JSON used on the QuickSnip open-source project.

Topics

Resources

License

Stars

Watchers

Forks

Languages