Write Your Lesson Information to a Markdown File From a ZSH Function

John Lindquist
InstructorJohn Lindquist
Share this video with your friends

Social Share Links

Send Tweet

Storing all the links to each repo and codesandbox inside of a markdown file will make it much easier to track where every lesson lives. This lesson walks you through using a zsh function to write out your info to a playlist.md file.

Instructor: [0:00] Rather than opening Chrome to these URLs, let's write them out to a markdown file we can store in our repo. First, I'm going to quickly rename all of these, with command D, to slug, since that's the lesson slug. I also want to get a proper title-case title from this, so I'll call this title and pass in change the case to title case.

[0:23] To start my markdown file, I can echo a new line and then a header two of the title, followed by a new line, and write that out to a playlist.md for our markdown file. Then I want to echo out two links. The first one is echo this out to playlist.md.

[0:42] The first on can be the branch where our demo lives. Let's take this here. We'll copy that and set up a GitHub variable. GitHub is equal to this but also has the GitHub URL bits. Then we can just put this here and here. Follow this with a new line. Then we'll add in our CodeSandbox, which is just this link as it is. CodeSandbox is equal to that. Then we can just replace this and this with CodeSandbox.

[1:18] Now I can delete this and remove all of this. Now, in any lesson, I can run my Egghead quick lesson. Type in some name like "Create a button that flies." Hit enter. You'll see in my terminal it's doing all the same tasks, but now it also created this file, playlist.md. Which if I click on one of these links, you'll see that the playlist.md is proper Markdown.

[1:45] I'll go ahead and add another lesson. Quick lesson, "Make a dropdown dance." Hit enter. You'll see our playlist will now have "Make a dropdown dance" on it. We can go here. If we go over here and switch to our "Make a dropdown dance," you can see I have all of my links and titles ready to be copied.