Sign inSign up

schogini/markdown-to-html

By schogini

Updated almost 2 years ago

Convert a Markdown file to an HTML file

Image
0

426

schogini/markdown-to-html repository overview

Markdown to HTML Converter with Clipboard Copy Functionality

This Docker image allows you to convert a Markdown file to an HTML file, with added functionality like syntax highlighting for code blocks, a "Copy to Clipboard" icon for each code block, and a customizable page title. The generated HTML page also includes rounded corner designs for the header and footer.

Features

  • Convert Markdown to HTML: Automatically converts your input.md file to a styled HTML file.
  • Syntax Highlighting: Pygments is used for code block syntax highlighting.
  • Copy to Clipboard: Each code block gets a "Copy to Clipboard" icon.
  • Custom Title: You can specify a custom title for the generated HTML page.
  • Rounded Corners: The header and footer have a modern, rounded-corner design.

How to Use

  1. Pull the Docker Image

    Pull the image from Docker Hub:

    docker pull your-dockerhub-username/markdown-to-html
    
  2. Run the Container

    You need to mount your current directory, which contains the input.md Markdown file, to the /app directory inside the container. Additionally, pass a string argument for the page title.

    Run the container using the following command:

    docker run --rm -v $(pwd):/app your-dockerhub-username/markdown-to-html "Your Page Title"
    

    This command will:

    • Mount your current directory to the /app directory inside the container.
    • Convert input.md (which should exist in your current directory) to an HTML file.
    • The string "Your Page Title" will be used as the title of the generated HTML file.
  3. Generated HTML File

    The HTML file will be generated in your current directory with a filename derived from the page title, where spaces are replaced with hyphens. For example:

    docker run --rm -v $(pwd):/app your-dockerhub-username/markdown-to-html "My Custom Page"
    

    This will generate my-custom-page.html in your current directory.

Example

Input (input.md)
# Welcome to My Page

Here’s a simple code example:

```python
print("Hello, World!")

### Output (HTML)

The generated HTML file will include syntax highlighting and a "Copy to Clipboard" button for each code block, along with the custom title and page design.

## Customization

The following customizations are available:

- **Page Title**: Pass your custom title when running the Docker container.
- **Copy to Clipboard**: The "Copy to Clipboard" functionality is automatically applied to every code block in the Markdown file.

## Source Code

The source code for this project can be found at: [GitHub](https://github.com/your-repo)

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
Instructions for Use:
  1. Change placeholders:

    • Replace your-dockerhub-username with your Docker Hub username.
    • Update https://github.com/your-repo if you're hosting the source code on GitHub.
  2. Optional:

    • You can add more sections (like "Contributing" or "Issues") if needed.
How to Upload to Docker Hub:
  1. Push your image to Docker Hub:
    docker tag markdown-to-html your-dockerhub-username/markdown-to-html
    docker push your-dockerhub-username/markdown-to-html
    

Tag summary

Content type

Image

Digest

sha256:3de7cb5cd

Size

51.4 MB

Last updated

almost 2 years ago

docker pull schogini/markdown-to-html