Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nocd5/md2html
Markdown to single HTML
https://github.com/nocd5/md2html
golang markdown md2html
Last synced: about 1 month ago
JSON representation
Markdown to single HTML
- Host: GitHub
- URL: https://github.com/nocd5/md2html
- Owner: nocd5
- License: mit
- Created: 2016-03-31T15:01:29.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2022-10-20T09:29:28.000Z (over 2 years ago)
- Last Synced: 2024-06-19T00:29:00.162Z (8 months ago)
- Topics: golang, markdown, md2html
- Language: Go
- Size: 20.2 MB
- Stars: 49
- Watchers: 3
- Forks: 9
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# md2html
[![Build status](https://github.com/nocd5/md2html/workflows/Build/badge.svg?branch=master)](https://github.com/nocd5/md2html/actions?query=workflow%3ABuild+branch%3Amaster)
![Test status](https://github.com/nocd5/md2html/workflows/Test/badge.svg?branch=master)Markdown to single HTML converter.
## Feature
The **md2html** converts Markdown to a single file HTML.
All scripts and css will be embeded in the file
and thus the converted file is viewable even offline.
Additionally, the **md2html** has option to embed image to HTML by base64 encode
and hence the file is conveyable without any resources.## Sample
[Github Pages](https://nocd5.github.io/md2html/index.html)
The html file is generated by following command
```bash
$ md2html example/*.md -e -t -m -s -f example/img/nocd5.png -c example/css/custom-css.css -o gh-pages/index.html
```## Installation
`go install github.com/nocd5/md2html/v2@latest`
## Usage
`md2html -i [-o ] [-e] [-t] [-m] [-s] [-f ]`
if `-o` option was abbreviated, `input Markdown file name` + `.html` will be used as output HTML file name.
### Embedding images
`-e/--embed` option enables embedding images that are located local storage by Base64 encoding.
### TOC
`-t/--toc` option enables generating TOC.
### Using MathJax
`-m/--mathjax` option enables using MathJax.
### Table row/col span
`-s/--span` option enables using rowspan/colspan for table tag
### Favicon
`-f/--favicon ` option enables embedding icon for favicon
### Add custom CSS
`-c/--css ` option enables additional CSS
## Example
Please execute the following commands to make example files.
```bash
# make html files from each markdown files
$ md2html -e example/*.md# make a concatinated single html file from markdown files
$ md2html -e -t example/*.md -o example/concat.html
```## Custom JS & CSS
```bash
$ go get -d github.com/nocd5/md2html
$ cd ${GOPATH}/src/github.com/nocd5/md2html###########################################################
# customize "{$GOPATH}/src/github.com/nocd5/md2html/src/" #
###########################################################$ npm install && gulp
$ assets.go.rb
$ go install
```## Use libraries
#### Go
- [yuin/goldmark](https://github.com/yuin/goldmark)
([License](https://raw.githubusercontent.com/yuin/goldmark/master/LICENSE))
- [yuin/goldmark-highlighting](https://github.com/yuin/goldmark-highlighting)
([License](https://raw.githubusercontent.com/yuin/goldmark-highlighting/master/LICENSE))
- [PuerkitoBio/goquery](https://github.com/PuerkitoBio/goquery)
([License](https://raw.githubusercontent.com/PuerkitoBio/goquery/master/LICENSE))
- [jessevdk/go-flags](https://github.com/jessevdk/go-flags)
([License](https://raw.githubusercontent.com/jessevdk/go-flags/master/LICENSE))#### JS
- [pkra/MathJax-single-file](https://github.com/pkra/MathJax-single-file)
([License](https://raw.githubusercontent.com/pkra/MathJax-single-file/master/LICENSE))
- [cferdinandi/smooth-scroll](https://github.com/cferdinandi/smooth-scroll)
([License](https://raw.githubusercontent.com/cferdinandi/smooth-scroll/master/LICENSE.md))#### CSS
- [sindresorhus/generate-github-markdown-css](https://github.com/sindresorhus/generate-github-markdown-css)
([License](https://raw.githubusercontent.com/sindresorhus/generate-github-markdown-css/master/license))