Remote GitHub CSS Demo

๐Ÿ“š Getting Started with md2html-action

๐Ÿ“š Getting Started with md2html-action

Welcome to md2html-action! This guide will help you quickly start converting Markdown files to beautiful, styled HTML using this powerful GitHub Action.

๐ŸŽฏ What is md2html-action?

md2html-action is a GitHub Action that converts Markdown files to stunning HTML using Pandoc. Itโ€™s designed to work with pure vanilla Markdown - no special setup, frontmatter, or configuration required!

โœจ Key Features

๐Ÿ› ๏ธ Prerequisites

Before you begin, ensure you have:

๐Ÿš€ Quick Setup

Step 1: Create Your Workflow

Create .github/workflows/convert-docs.yml in your repository:

name: Convert Markdown to HTML

on:
  push:
    paths: ["docs/**/*.md"]
  pull_request:
    paths: ["docs/**/*.md"]

jobs:
  convert:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Convert Markdown to HTML
        uses: CameronBrooks11/md2html-action@main
        with:
          source-dir: "docs" # Directory containing your .md files
          output-dir: "html" # Where to save the HTML files
          stylesheet: "technical" # Choose: default, minimal, academic, technical, blog, corporate
          template: "default" # Choose: default, minimal, github

Step 2: Create Your First Markdown File

Create a docs/ directory and add docs/index.md:

# My Documentation

Welcome to my documentation site!

## Getting Started

This is a simple Markdown file that will be converted to beautiful HTML.

### Features

- Pure Markdown support
- No frontmatter required
- Automatic table of contents
- Responsive design

## Code Examples

Here's some Python code:

\```python
def hello_world():
print("Hello from md2html-action!")
\```

## Links

- [GitHub Repository](https://github.com/your-username/your-repo)
- [Documentation](https://your-username.github.io/your-repo/)

Step 3: Push and Watch the Magic

  1. Commit and push your changes:

    git add .
    git commit -m "Add md2html-action documentation"
    git push
  2. Check the Actions tab in your GitHub repository

  3. Watch as your Markdown is converted to stunning HTML!

๐ŸŽจ Choosing Your Theme

md2html-action includes 6 professional themes:

Theme Best For Description
๐ŸŽ“ Academic Research papers, theses Traditional typography, scholarly formatting
๐Ÿ’ป Technical API docs, developer guides Modern tech company design with Inter fonts
๐Ÿ“ Blog Personal blogs, articles Comfortable reading typography
๐Ÿข Corporate Business docs, reports Professional, authoritative styling
๐ŸŽจ Default General documentation Clean, balanced design
โšก Minimal Simple sites Lightweight, fast-loading

To change themes, simply update the stylesheet parameter in your workflow:

- uses: CameronBrooks11/md2html-action@main
  with:
    stylesheet: "academic" # Change this to any theme name

๐Ÿ“ Writing Effective Markdown

Essential Markdown Syntax

md2html-action works with any standard Markdown file. Here are the key elements:

Headers and Navigation

# Main Title (H1)

## Section (H2)

### Subsection (H3)

#### Details (H4)

Pro Tip: Headers automatically generate a table of contents!

Text Formatting

**Bold text** for emphasis
_Italic text_ for subtle emphasis
`inline code` for technical terms
~~Strikethrough~~ for corrections

Lists and Tasks

Unordered lists:

- First item
- Second item
  - Nested item
  - Another nested item

Ordered lists:

1. Step one
2. Step two
3. Step three

Task lists:

- [x] Completed task
- [ ] Pending task
- [ ] Future task
[Link text](https://example.com)
[Internal link](other-page.md)
![Image alt text](path/to/image.jpg)
![Local image](media/example.jpg)

Code Blocks

Use triple backticks with language specification:

```python
def example_function():
    """This is a Python function."""
    return "Hello, World!"
```

```javascript
const greeting = (name) => {
  return `Hello, ${name}!`;
};
```

```bash
# Shell commands
npm install
git commit -m "Update docs"
```

Tables

| Column 1 | Column 2 | Column 3 |
| -------- | -------- | -------- |
| Data 1   | Data 2   | Data 3   |
| Row 2    | More     | Data     |

Blockquotes

> This is a blockquote.
> It can span multiple lines.
>
> Perfect for highlighting important information!

๐Ÿ”ง Working with Pure Markdown

One of md2html-actionโ€™s greatest strengths is its support for pure vanilla Markdown:

โœ… What Works Out of the Box

# My Documentation

This is a simple Markdown file that requires no special setup!

## Features

- Pure Markdown support
- No frontmatter required
- Automatic title extraction from `# Heading`
- Table of contents generation
- Responsive design

## Code Example

\```python
def hello():
print("No configuration needed!")
\```

## Links

- [Another page](getting-started.md)
- [External link](https://github.com)

๐ŸŽ›๏ธ Optional Frontmatter

While not required, you can add frontmatter for more control:

---
title: "Custom Page Title"
description: "SEO-friendly page description"
author: "Your Name"
date: "2024-01-01"
---
# Your Content Here

The frontmatter above is completely optional but gives you more control over metadata.

๐ŸŒ Organizing Your Documentation

your-repository/
โ”œโ”€โ”€ docs/                    # Your Markdown files
โ”‚   โ”œโ”€โ”€ index.md            # Homepage
โ”‚   โ”œโ”€โ”€ getting-started.md  # Getting started guide
โ”‚   โ”œโ”€โ”€ api/                # API documentation
โ”‚   โ”‚   โ”œโ”€โ”€ index.md
โ”‚   โ”‚   โ””โ”€โ”€ endpoints.md
โ”‚   โ”œโ”€โ”€ guides/             # User guides
โ”‚   โ”‚   โ”œโ”€โ”€ installation.md
โ”‚   โ”‚   โ””โ”€โ”€ configuration.md
โ”‚   โ””โ”€โ”€ media/              # Images and assets
โ”‚       โ”œโ”€โ”€ logo.png
โ”‚       โ””โ”€โ”€ screenshots/
โ”œโ”€โ”€ .github/
โ”‚   โ””โ”€โ”€ workflows/
โ”‚       โ””โ”€โ”€ docs.yml        # Your md2html-action workflow
โ””โ”€โ”€ README.md
  1. Start with index.md - This becomes your homepage
  2. Use clear, descriptive filenames - getting-started.md not start.md
  3. Create logical hierarchies - Group related content in folders
  4. Link between pages - Use relative links like [Guide](guides/installation.md)
  5. Include a media folder - Keep images organized

๐Ÿ“ฑ Mobile-Friendly Tips

All themes are fully responsive, but you can optimize for mobile:

Image Sizing

![Responsive image](media/screenshot.jpg)

<!-- Images automatically scale to container width -->

Table Formatting

| Feature | Mobile        | Desktop      |
| ------- | ------------- | ------------ |
| Layout  | Single column | Multi-column |
| TOC     | Collapsible   | Sidebar      |

Content Structure

โšก Performance Tips

  1. Optimize Images - Use compressed images (WebP, optimized JPG/PNG)
  2. Choose the Right Theme - Minimal theme loads fastest
  3. Organize Content - Split very long pages into multiple files
  4. Use Proper Headings - Creates better TOC structure

๐ŸŽฏ Next Steps

Now that you understand the basics:

  1. ๐Ÿ“– Read the Advanced Configuration Guide - Learn about custom templates, advanced Pandoc options, and deployment strategies

  2. ๐ŸŽจ Explore the Demo Gallery - See all themes in action at the demo gallery

  3. ๐Ÿ”ง Customize Your Setup - Experiment with different themes and templates

  4. ๐Ÿ“š Check Real Examples - Browse the source code of this documentation for reference

๐Ÿ†˜ Troubleshooting

Common Issues

Problem: Action not triggering
Solution: Check your workflow file paths and ensure youโ€™re pushing to the correct branch

Problem: Styles not applying
Solution: Verify the stylesheet name in your workflow matches available themes

Problem: Images not showing
Solution: Use relative paths and ensure images are in your source directory

Problem: TOC not generating
Solution: Make sure youโ€™re using proper Markdown headers (#, ##, ###)

Getting Help


Ready to dive deeper? Continue to Advanced Configuration for power-user features!