# HackMD To PDF
## Table of Content
- [HackMD To PDF](#HackMD-To-PDF)
- [Table of Content](#Table-of-Content)
- [How to Use](#How-to-Use)
- [1. Brower Setup](#1-Browser-Setup)
- [2. Environment Setup](#2-Environment-Setup)
- [3. Start Local Server](#3-Start-Local-Server)
- [4. Enter HackMD ID](#4-Enter-HackMD-ID)
---
## How to Use
### 1. Browser Setup
> Chrome Recommended!
Download a markdown viewer plugin for your browser.
Chrome: [MD Reader](https://chromewebstore.google.com/detail/md-reader/medapdbncneneejhbgcjceippjlfkmkg) (Recommended)
Firefox: [Markdown Viewer](https://addons.mozilla.org/firefox/addon/markdown-viewer-chrome/) (Recommended)
### 2. Environment Setup
Download or upgrade [Node.js](https://nodejs.org) to **v20.11.0**, npm and npx to **v10.1.0**.
Download the code.
Create a copy of `.env.sample` and name it as `.env`.

Create your [HackMD API Key](https://hackmd.io/settings#api).
Copy your key to `.env` file.

### 3. Start Local Server
Run the commands bellow to start the server.
```
npm install
npm run dev
```
Which the result should look something like this :

Go to your localhost server (http://localhost:3000).
### 4. Enter HackMD ID
HackMD ID is the last section of the URL.
```
https://hackmd.io/9Fe7huR5QCG_jTG_baWVWw
```
In this case the ID is `9Fe7huR5QCG_jTG_baWVWw`
```
https://hackmd.io/@waltson/H1rSNYAd6
```
In this case the ID is `H1rSNYAd6`
Copy the ID and paste in the input section.

After hitting the submit button, the result will be shown in a new tab, the markdown viewer plugin should styled markdown content instead of showing raw text, press `ctrl + p` to print the page, choose **Save as PDF**.