![]() Thanks again for sticking around! We’ll catch you in the next one.Enter fullscreen mode Exit fullscreen mode Sample Programs 500 Code Snippet Release.Sample Programs 25 Project Tests Release.Otherwise, that’s all I have! While you’re here, why not check out some of the other projects I’m working on: That way, I can show the project some love. If you’re interested in including the library in your own projects, don’t forget to include SnakeMD in your dependencies list (e.g., requirements.txt). That said, at the moment, I am quite pleased with where the library is at as it serves me in four of my own repos: Plans for SnakeMDĪt the moment, I don’t have many plans beyond what you can see in the list of issues. Naturally, this sort of thing can be done for all five classes, if needed. The MDList is then passed to `add_element()`. You can then convert that into an MDList using a list comprehension. In this example, we have some dictionary called `items` which contains a list of items mapped to URLs. Here’s an example of what that might look like: # items = If you want to include links in any of those strings, you will need to construct the list using MDList directly. For example, the `add_ordered_list()` function only accepts strings. Typically, you would want to take advantage of these classes if you needed to embed links in them. Elements are considered the following standalone sections of a markdown file:Įach of these elements have their own corresponding classes which you can read more about in the docs : ![]() In that case, we support the `add_element()` function. That said, sometimes you want more control. In general, SnakeMD supports easy creation of markdown files through all of the convenience methods in Document. Keep that in mind! Modifying a Markdown Document (Advanced) If we were to swap these lines of code, the header would come after the paragraph. For example, if we want to add a header and some text, we would do that as follows: doc.add_header("Introduction") Keep in mind that information is always added in the order that the `add_` functions are executed. ![]() With a document created, we can now add whatever we want. In the future, we’ll probably streamline this process with code that looks as follows: import snakemdĭoc = snakemd.create_doc("Title") Modifying a Markdown Document (Basic) Once you have SnakeMD installed, you can create your first document as follows: from snakemd import Document If you don’t care about cluttering your system with Python packages, you can install SnakeMD as follows: pip install snakemd Creating a Markdown Document Like most Python packages, SnakeMD can be installed using pip. To see the full range of features, check out the main README for the project. In addition to being able to add the usual elements to a markdown file like headers and tables, SnakeMD also offers a few convenience features like being able to add a table of contents. That’s when I decided to extract the code responsible for automating the various markdown tasks into its own library: SnakeMD.įor the uninitiated, SnakeMD is an object-oriented Python library which allows a user to create and modify markdown files. Until recently, however, all of those tools were integrated under one repository meant for automating various tasks in the Sample Programs repo. Later, I wrote another tool to automate each language’s README. For example, I wrote a tool to automate the GitHub wiki. In an effort to improve the experience of that collection, I had written several tools to automate various tasks related to it. Basically, it’s a collection of programs in as many languages as possible. If you’ve followed any of the projects we work on at The Renegade Coder, you might be familiar with the Sample Programs repo. Naturally, I figured it was time to formally introduce a library I created called SnakeMD to help generate markdown using Python. Most recently, I wrote about automating your GitHub profile which would involve the use of markdown. As a result, there’s a good chance you’ve bumped into it before. ![]() Similarly, I’ve seen it used in other places such as in Jekyll, which is supported by GitHub pages. In general, markdown is common in a lot of places, but I’ve seen in most often on GitHub has the default README format. Think of it has a stripped down version of HTML. In essence, markdown is a programming language ( yes, I said programming language) developed for quickly prototyping webpages and documents. That said, as a quick overview, I figured I’d take a moment to explain what it is. If you found this article, there is a good chance you’re already familiar with markdown. 3 Plans for SnakeMD A Quick Overview of Markdown
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |