Comprehensible input is simply an instructional shift when teaching material provides input where students understand most, but not all, of the language.
This project is a simple Markdown-to-HTML converter written in Go. It includes functionality to process Markdown files, generate corresponding HTML files using a template, and serve the generated files through a lightweight HTTP server. The project also includes a Makefile
for convenient build and deployment.
- Converts Markdown (
.md
) files to HTML with a customizable HTML template. - Generates a Table of Contents (TOC) for headings in the Markdown files.
- Includes basic Markdown elements: headings, lists, code blocks, inline formatting (bold, italic, links), and blockquotes.
- Copies a CSS file to style the output HTML.
- Lightweight HTTP server to host the generated HTML files locally.
- Hosted on github pages.
.
βββ main.go # Markdown processing logic
βββ server.go # HTTP server for serving generated files
βββ Makefile # Makefile for build and server commands
βββ template.html # HTML template used for rendering output
βββ styles.css # CSS for styling the output HTML
βββ markdown/ # Input directory for Markdown files
βββ output/ # Output directory for generated HTML files
- Go (1.18+)
- A terminal with
make
installed (optional but recommended for using theMakefile
)
Build and Run
Use the following commands via the Makefile
to run the project locally:
- Generate HTML Files
make build
- Start HTTP Server
make server
The server will host the files in the output/
directory at http://localhost:8080/
.
If you prefer not to use the Makefile
, you can execute the Go files manually:
-
Generate HTML Files
go run main.go
-
Start the HTTP Server
go run server.go
The template.html
file is used to generate the output HTML. You can edit this file to modify the structure or style of the generated HTML files. The following placeholders are used in the template:
{{title}}
: Replaced with the title of the current Markdown file.{{toc}}
: Replaced with the Table of Contents (TOC).{{content}}
: Replaced with the converted Markdown content.
The styles.css
file is copied to the output directory and included in the generated HTML. Modify this file to customize the appearance of the generated pages.
Markdown files are parsed and converted into HTML using custom logic in the parseMarkdown
function. Supported Markdown features include:
- Headings (
#
,##
, etc.) - Lists (ordered and unordered)
- Inline Formatting (bold, italic, links)
- Blockquotes
- Code Blocks (indented or fenced with backticks)
Error messages are printed to the console when issues occur, such as missing files or directories. Ensure that markdown/
, template.html
, and styles.css
exist before running the project.
- Fork the repository.
- Create a new branch:
git checkout -b feature/your-feature-name
- Commit your changes:
git commit -m "Add some feature"
- Push to the branch:
git push origin feature/your-feature-name
- Open a Pull Request.
This project is licensed under the MIT License. See the LICENSE
file for more details.