Skip to content

πŸ“š A tool to practice reading stories in the German language

License

Notifications You must be signed in to change notification settings

mohsenkhosroanjam/german-stories

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

44 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

German stories

Comprehensible input is simply an instructional shift when teaching material provides input where students understand most, but not all, of the language.

The project

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.


Features

  • 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.

Project Structure

.
β”œβ”€β”€ 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

Setup and Usage

Prerequisites

  • Go (1.18+)
  • A terminal with make installed (optional but recommended for using the Makefile)

Running the Project

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/.

Manual Execution

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

Customization

Template File

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.

Styles

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.


Development

Markdown Parsing

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 Handling

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.


Contribution

  1. Fork the repository.
  2. Create a new branch:
    git checkout -b feature/your-feature-name
  3. Commit your changes:
    git commit -m "Add some feature"
  4. Push to the branch:
    git push origin feature/your-feature-name
  5. Open a Pull Request.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

About

πŸ“š A tool to practice reading stories in the German language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 46.7%
  • HTML 30.7%
  • CSS 21.5%
  • Makefile 1.1%