{"library":"snakemd","title":"SnakeMD","type":"library","description":"SnakeMD is a Python library designed for programmatically generating Markdown documents. It allows users to create headings, paragraphs, lists, tables, and other Markdown elements using a Pythonic API. The library is actively maintained, with version 2.4.0 being the latest stable release, and typically sees updates every few months.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install snakemd"],"cli":null},"imports":["from snakemd import Document","from snakemd import Paragraph","from snakemd import Heading","from snakemd import Table"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":"https://www.snakemd.io","github":"https://github.com/TheRenegadeCoder/SnakeMD","docs":"https://www.snakemd.io/en/latest/docs/","changelog":"https://www.snakemd.io/en/latest/version-history/","pypi":"https://pypi.org/project/snakemd/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"import snakemd\n\n# Create a new Document\ndoc = snakemd.Document(\"My Article\")\n\n# Add a heading\ndoc.add_heading(\"Welcome to SnakeMD!\")\n\n# Add a paragraph\ndoc.add_paragraph(\"This is an example of how to use SnakeMD to generate Markdown.\")\n\n# Add an ordered list\ndoc.add_ordered_list([\"First item\", \"Second item\", \"Third item\"])\n\n# Add a table\ndoc.add_table(\n    headers=[\"Name\", \"Age\"],\n    data=[[\"Alice\", \"30\"], [\"Bob\", \"24\"]]\n)\n\n# Output the Markdown to a file\n# In a real scenario, you might want to save to a specific path\n# and handle potential file I/O errors.\noutput_filename = os.environ.get('SNAKEMD_OUTPUT_FILE', 'output.md')\nwith open(output_filename, \"w\") as f:\n    f.write(doc.render())\n\nprint(f\"Markdown written to {output_filename}\")","lang":"python","description":"This quickstart demonstrates how to create a basic Markdown document with headings, paragraphs, lists, and tables, and then render it to a file using SnakeMD. It covers the core `Document` object and common content addition methods.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}