Skip to content

A CLI tool to generate an HTML file from a Markdown file.

License

Notifications You must be signed in to change notification settings

surferwat/md-to-html

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

md-to-html

Description

md-to-html is a CLI to generate an HTML file from a given Markdown file. It is essentially a language conversion of the open-source program named mdtofile written in Go by @d0iasm.

Input

  • <example.md> - a Markdown file

Sample screen output

done!
example.md converted to example.html

EBNF for Markdown grammar

Document = { Block }, EOF ;
Block = Paragraph | Headings | Lists | CodeBlockFence ;
Inline = Link | Rawtext | Emphasis | Strong | Break ;
Paragraph = String, { String }, Newline ;
Headings = H1 | H2 | H3 | H4 | H5 | H6 ;
H1 = "#", Inline ;
H2 = "#" * 2, Inline ;
H3 = "#" * 3, Inline ;
H4 = "#" * 4, Inline ;
H5 = "#" * 5, Inline ;
H6 = "#" * 6, Inline ;
Lists = List, ( List | Lists )* ;
List = ( (" ")*, "-", " ", Inline ) | Lists ;
CodeBlockFence = "```";
Link = "[" Rawtext "]", "(" Rawtext ")";
Emphasis = "*" Rawtext "*" | "_" Rawtext "_" ;
Strong = "**" Rawtext "**" | "__" Rawtext "__" ;
Break = Rawtext "  " ;
String = { Character } ;
Newline = "\n" ;

Installation

git clone https://github.com/surferwat/md-to-html.git

Usage

Step 1: compile program

g++ -o md-to-html.out main.cpp exception.h exception.cpp htmlline.h htmlline.cpp html.h html.cpp -std=c++11

Step 2: run program

./md-to-html.out example.md

Test

Step 1: compile program

g++ -o test.out test.cpp exception.h exception.cpp htmlline.h htmlline.cpp html.h html.cpp -std=c++11

Step 2: run test

./test.out

To Do

  • add suport for css
  • refactor error handling
  • review implementation of break

References

About

A CLI tool to generate an HTML file from a Markdown file.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages