December 2021
Intermediate to advanced
510 pages
11h 20m
English
Let’s implement the initial version of the Markdown Preview tool. We’ll call this tool mdp (for MarkDown Preview) and accept the file name of the Markdown file to be previewed as its argument. This tool will perform four main steps:
Read the contents of the input Markdown file.
Use some Go external libraries to parse Markdown and generate a valid HTML block.
Wrap the results with an HTML header and footer.
Save the buffer to an HTML file that you can view in a browser.
When writing Go programs, you can organize your code in many ways. For this tool, you’ll keep all the code in a single package main since this functionality won’t be used outside the CLI implementation. In Chapter 4, Navigating the File ...
Read now
Unlock full access